I need to be able to advance my for loop control index variable - from within the loop
for i=1,5 do
io.write(("i: %d; "):format(i))
i = i + 2 -- this has no effect, as 'for' is in control of the index var.
end
I recommend you to use 'while'.
local i = 1
while i <= 5 do
io.write(("i: %d; "):format(i))
i = i + 2 -- it works
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With