Code: Select all
if(love.keyboard.isDown(love.key_f) then
print("hit f")
end
if(mouse.blockingID > 0 and love.keyboard.isDown(love.key_d)) then
print("hit d")
table.remove(object, mouse.blockingID)
mouse.blockingID = nil
end
if(love.keyboard.isDown(love.key_z)) then
print("hit z")
end
But here is what actually happens:
Press f - get debug line. (as expected)
Press d, get nothing. (as expected)
Hold an object and press d - get debug line. (as expected)
Press z - get nothing. (??)
Hold an object and press z - get debug line. (??)
If I move the f test such that it follows the d test, then the f test behaves in the same way the z test does. If I move both the f and z tests above the d test, everything works the way I expect it to.
I believe lua has short-circuiting, so when mouse.blockingID > 0 fails I expect lua to just move on to the next chunk. But maybe it's getting hung up there somehow? This behavior makes no sense to me. I can't tell if it's a bad behavior in love.keyboard or just some aspect of lua I don't understand.
Clarity would be appreciated.
--Mr. Strange