Search code examples
lualove2d

Does love.keyreleased(key) function the same as love.keyboard.isDown?


Does the love.keyreleased(key) function the same as love.keyboard.isDown?

For example, can I declare:

function love.update()

    if love.keyreleased("left") then
            hero = heroLeft
    end
end     

Solution

  • love.keyreleased is a callback function. It's not a function you are supposed to call. It's a function you register with the system that takes a key. The system will call it whenever a key is released.