Comparing numbers bug
Not sure if its a bug. In my mod i'm comparing values stored in a table. And I found things like value > 1.9 would return true if value = 1.9. The weird this is this returns false right after a reload UI. But then if I shift the number down to 1.8 then back to 1.9, it thinks 1.9 is greater than 1.9.
The fix was to compare against 1.901. My only guess is lua treats everything as float internally and I know comparing floats can give back inaccurate results.
|