Skip to content

PlayerInputEvent

Methods

PlayerInputEvent:getDevice()

  • Returns "keyboard"|"mouse"|"gamepad"|"unknown"

PlayerInputEvent:getKeyCode()

Errors if the input device isn't "keyboard"

  • Returns integer, an InputKey index

PlayerInputEvent:getGamepadButton()

Errors if the input device isn't "gamepad"

  • Returns integer

PlayerInputEvent:getMouseButton()

Errors if the input device isn't "mouse"

  • Returns integer, 0 = left, 1 = middle, 2 = right, 3-7 = extra buttons (X1-X5)

PlayerInputEvent:isMapped()

Whether this physical input is currently bound to a game control

  • Returns boolean

PlayerInputEvent:cancel()

Suppresses this input for the rest of this frame: the game control it may be bound to, if any, does not see it. Only cancels the frame the key/button was first pressed on, not every frame it's held.