lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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