The following table keys are used with joypad lib, stylus lib, or input lib Lua functions.
As an example, this script draws text on the screen when B is pressed:
local table={}

while true do
  table=joypad.get(1)
  if table.B then
    gui.text(0,0, "B is pressed")
  end
  emu.frameadvance()
end

Table keys

Table keys are case sensitive. Almost all keys are boolean, although ones related to position or analog are integers. The value nil or false means "not pressed", anything else means "pressed".

Joypad lib

These keys are used with functions beginning with joypad. All keys are boolean.
Due to possible implementation differences with joypad.get, it is recommended to use boolean style 'if' (if table.right then) rather than equality comparison (if table.right==true then)
Application of joypad.set only works for the following frame. It must be applied on each frame to hold down the keys.
BizHawk: We can't possibly document the possibilities here, use joypad.get() to get a list of the buttons for the current core + configuration you are using, and use those. Also joypad.set(buttonName) is preferred over joypad.set(buttonName, controllerNumber).
FCEUX: A, B, select, start, up, down, left, right
Snes9x: R, L, X, A, right, left, down, up, start, select, Y, B
Gens: up, down, left, right, A, B, C, start, X, Y, Z, mode
VBA: A, B, select, start, right, left, up, down, R, L
PCSX: select, l3, r3, start, up, right, down, left, l2, r2, l1, r1, triangle, circle, x, square
PCEjin/VBjin: I, II, Select, Run, Up, Right, Down, Left
DeSmuME (joypad lib): debug, R, L, X, Y, A, B, start, select, up, down, left, right, lid
For Final Burn Alpha, the keys are the names that the emulator uses, and are specific to each game. They are listed under input configuration.

DeSmuME stylus lib

These keys are used with functions beginning with stylus. The key 'x' is an integer from 0 to 255, 'y' is an integer from 0 to 192, and 'touch' is a boolean.
Application of stylus.set only works for the following frame. It must be applied on each frame to hold down the stylus.
DeSmuME (stylus lib): x, y, touch

Input lib

These keys are used with functions beginning with input.
The Lua function input.get returns a table of which keyboard buttons are pressed as well as PC mouse status. Labels refer to US keyboard layout.
All keyboard table keys are boolean.
"..." denotes an obvious sequence which has been omitted.
Keyboard: backspace, tab, enter, shift, control, alt, pause, capslock, escape, space, pageup, pagedown, end, home, left, up, right, down, insert, delete, 0, 1, ..., 9, A, B, ..., Z, numpad0, numpad1, ..., numpad9, numpad*, numpad+, numpad-, numpad., numpad/, F1, F2, ..., F24, numlock, scrolllock, semicolon, plus, comma, minus, period, slash, tilde, leftbracket, backslash, rightbracket, quote
Mouse position is returned in terms of game screen pixel coordinates. The key 'xmouse' is an integer from 0 to 255, 'ymouse' is an integer from 0 to 223, and 'leftclick', 'rightclick', and 'middleclick' are all boolean.
Mouse: xmouse, ymouse, leftclick, rightclick, middleclick

LuaScripting/TableKeys last edited by feos on 8/4/2022 1:56 PM
Page History Latest diff List referrers View Source