remove redundant code from lua scripts