Can someone explain this to me?
for i = 1, 5 do
print(i)
i = i - 1
print(i)
end
Output:
1
0
2
1
3
2
and so forth
I expected that I would change between 1 and 0. But, obviously, it continues to grow, as if I did not change it at all. What's happening?
I need to delete the i'th table element from time to time. So the next item to handle will be me again. In C, I would simply write -i at the end of my contents of the loop. Any official way in lua? :)
source
share