[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Strange behavior with for loop
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 9 May 2016 09:22:17 +0200
2016-05-08 21:05 GMT+02:00 Christophe Devalland
<christophe.devalland@gmail.com>:
> Ok, thanks for explanations. Is there a workaround ?
function loop(start,stop,step)
return function()
local old = start
start = start+step
if old<stop or math.abs(old-stop)<1e-14 then return old end
end
end
for i in loop(-0.5,0.5,0.2) do
print(i)
end