darklua icon indicating copy to clipboard operation
darklua copied to clipboard

Unwrap small numeric for loops

Open jeparlefrancais opened this issue 5 years ago • 1 comments

When a numeric for statement is used with a constant start, end and/or step value, the loop can be unwrapped into the repeated statements of the block.

This rule should be parametrized with the maximum iteration count ((end - start) / step) and the number of statements in the block.

for i=1, 3 do
    print(i)
end

Turns into:

print(1)
print(2)
print(3)

jeparlefrancais avatar Feb 18 '20 17:02 jeparlefrancais