Key

Client only. Keyboard, mouse and controller buttons. Keys are named by position on a US keyboard, whatever the layout: a to z and 0 to 9, f1 to f12, numpad0 to numpad9 (or num0 to num9), up, down, left, right, shift, ctrl, alt and their l or r forms, space, enter, escape, tab, backspace, insert, delete, home, end, pageup, pagedown, capslock, mouse1 to mouse5, grave, minus, equals, lbracket, rbracket, backslash, semicolon, apostrophe, comma, period and slash. Connected XInput controllers use the engine's names: xi_a, xi_b, xi_x, xi_y, xi_dpad_up, xi_dpad_down, xi_dpad_left, xi_dpad_right, xi_shoulderl and xi_shoulderr (LB, RB), xi_triggerl_btn and xi_triggerr_btn (LT, RT), xi_thumbl and xi_thumbr (sticks pressed), xi_start and xi_back. Binds fire only in a world, with the game window active and no chat or web view taking typed text. For keys players can change themselves in the game's settings, see Keybinds.

key.getLabel()

Key.getLabel(key)

The key's label on the player's keyboard layout.

key.bind()

Key.bind(key, stateOrHandler, handler)

Calls a handler when a key goes down, up or both. The handler receives (key, 'down' or 'up').

key.unbind()

Key.unbind(key, state, handler)

Removes this resource's binds of a key, or only those of one state or handler, if given.

key.isDown()

Key.isDown(key)

Whether a key is being held. False for an unknown name.