In some cases (for example, when the user is using the wrong Löve version), I want to overwrite all callbacks, display something else (an error message) and exit on any key. That's very simple to do, like so (pseudocode, untested, but you get the idea):
Code: Select all
function checkLoveVersion()
local major, minor, revision, codename = love.getVersion( )
if minor != 9 then
love.draw = function()
love.graphics.print( "Using wrong löve version! Need Version 0.9", 10, 10 )
end
love.keypressed = love.quit
end
end
However, I want to avoid that some other callback (for example, textinput) is still present, so I have to manually set all of those to nil. Is there a way to do this automatically? I want to make sure this works over all love versions and future versions as well, and I want to make sure I don't forget some callback.
I'm thinking something like (of course this won't work, because the callbacks aren't in the "callbacks" table):
Code: Select all
for i, c in pairs( love.callbacks ) do
love.callbacks[i] = nil
end