Lutro - Documentation

love.keyboard

Provides an interface to the keyboard exposed by the libretro frontend.

Keyboard availability depends on the frontend and platform. Lutro polls libretro keyboard state once per frame and uses libretro key codes as scancodes.

love.keyboard.isDown

Returns whether at least one of the requested keys is pressed.

pressed = love.keyboard.isDown("space")
pressed = love.keyboard.isDown("space", "a")

Key names follow Lutro's libretro key map. Common values include letters, digits, arrows, function keys and modifiers:

"a".."z", "0".."9"
"space", "return", "escape", "tab", "backspace"
"up", "down", "left", "right"
"f1".."f15"
"lshift", "rshift", "lctrl", "rctrl", "lalt", "ralt"

love.keyboard.getScancodeFromKey

Returns the libretro key code for a key name.

scancode = love.keyboard.getScancodeFromKey("f")

In Lutro, scancodes are numeric libretro keyboard constants. They are useful when handling keyboard callbacks or when interoperating with libretro-specific code.

love.keyboard.getKeyFromScancode

Returns the key name for a libretro key code.

key = love.keyboard.getKeyFromScancode(scancode)

love.keypressed

This callback is called when a key is pressed.

function love.keypressed(key, scancode, isrepeat)
  print("pressed", key, scancode)
end
Arguments:
key
The key name.
scancode
The numeric libretro key code.
isrepeat
Always false for now.

love.keyreleased

This callback is called when a key is released.

function love.keyreleased(key, scancode, isrepeat)
  print("released", key, scancode)
end