2016 March 07
originally posted on facebook

Today I fixed a bug in my lua code by adding the lines:

if x == 0 then
    x = 0
if y == 0 then
    y = 0

Turns out lua has a “negative zero”, which is equal to zero and behaves almost the same except when printed to a string. I used such strings as keys in a hash map which then caused the program to hang in an infinite loop because its logic about what was in the hash map was wrong.

Follow RSS/Atom feed or twitter for updates.