When checking a IF evaluation in WHILE in lua:
stopper = 0;
needle = 0.14;
while stopper < 0.2 do
if stopper == needle then
print ("Finally!")
end
stopper = stopper + 0.01
end
"Finally!" never gets printed if needle = 0.14 but does if needle = 0.15 (or 0.16, 0.17).
Is there a way to make it work? I suppose that this has to do with how LUA handles floats but I am not sure.
Obs:
- both counter and needle types are number (when checked like: type(counter))
- using tonumber(counter) == tonumber(needle) does not help
- there is a work around using tostring but I do not want it for obvious performance reasons