Originally Posted by sirann
Then I saw
Lua Code:
for i=1, gridWidth, 1 do grid[i] = {} end
which I'm pretty sure creates nested tables at keys of 1-9-1, which is a bit redundant. Should just be
|
While it is redundant, it's not for the reason you think -- the third parameter in a
for loop just specifies how much to increment
i on each loop. 1 is the default value, so you do not need to explicitly specify 1. However, if you wanted to iterate through all even numbers from 4 to 9000, for example, you could do this:
Code:
for i = 4, 9000, 2 do ... end