love.keypressed

Callback function triggered when a key is pressed.

Function

Synopsis

love.keypressed( key, unicode )

Arguments

KeyConstant key
Character of the key pressed.
number unicode
The unicode number of the key pressed.

Returns

Nothing.

Examples

Exit the game when the player presses the Escape key.

function love.keypressed(key, unicode)
   if key == "escape" then
      love.event.push('q')
   end
end

See Also


Other Languages