What's best to keep a value for only 1 frame?
Posted: Tue Oct 05, 2021 4:32 am
I'm storing keypresses detected from love.keypressed() into the var "KEY" (for other functions), but only need it for 1 frame, and so I added "KEY = nil" at the end of love.update.
So, is it better to have "KEY = nil" there, or "if KEY then KEY = nil end"? Would there be a simpler or "official" way to keep values only for a single frame?
Thanks!
So, is it better to have "KEY = nil" there, or "if KEY then KEY = nil end"? Would there be a simpler or "official" way to keep values only for a single frame?
Thanks!