How to organize such a for loop in lua?

for (t = 0; t < 1 + step; t += step) 

Did

 for t = 0, step + 1, t = t + step do print (test) end 

does not work, error.

    1 answer 1

    the third parameter is a step, not an assignment. lua herself will do it.

     step = 0.1 for t = 0, step + 1, step do print (t) end 

    I can see only one trick - the most recent value (in my case, this 1.1 should not fall in the initial version, but it falls into lua).

    therefore more correct

     step = 0.1 for t = 0, 1, step do print (t) end 

    But real arithmetic is such, for equality it is very dangerous to compare real numbers.