Skip to content

Instantly share code, notes, and snippets.

@Novaras
Last active December 26, 2022 18:26
Show Gist options
  • Save Novaras/117d341c2f9d71385d9b32b6ad88c221 to your computer and use it in GitHub Desktop.
Save Novaras/117d341c2f9d71385d9b32b6ad88c221 to your computer and use it in GitHub Desktop.

The following is a list of all the globally available KEY* variables.

You can see the global scope for yourself by invoking the global function globals:

globals(); -- outputs all globals

-- prints them
for k, v in globals() do
  print(k .. ": " .. tostring(v));
end

To filter the list as below:

for k, v in globals() do
	if (strfind(k, "%w+KEY")) then
		print(k .. ": " .. v);
	end
end

Note there are also some rouge keynames such as the arrow keys:

ARRLEFT: 37
ARRUP: 38
ARRRIGHT: 39
ARRDOWN: 40
BACKSLASHKEY: 220 
ENDKEY: 35 
FIVEKEY: 53 
BKEY: 66 
SPACEKEY: 32 
PAUSEKEY: 19 
XKEY: 88 
NUMSLASHKEY: 111 
F5KEY: 116 
F4KEY: 115 
ESCKEY: 27 
PAGEUPKEY: 33 
IKEY: 73 
THREEKEY: 51 
NUMDOTKEY: 110 
QKEY: 81 
SCROLLKEY: 145 
BACKSPACEKEY: 8 
DELETEKEY: 46 
NUMSTARKEY: 106 
ONEKEY: 49 
TWOKEY: 50 
F2KEY: 113 
F3KEY: 114 
RKEY: 82 
CKEY: 67 
PLUSKEY: 187 
HKEY: 72 
SHIFTKEY: 16 
MINUSKEY: 189 
CONTROLKEY: 17 
F1KEY: 112 
LKEY: 76 
F7KEY: 118 
PKEY: 80 
YKEY: 89 
SEVENKEY: 55 
APOSTROPHEKEY: 222 
TILDEKEY: 192 
DKEY: 68 
F12KEY: 123 
EKEY: 69 
F9KEY: 120 
INSERTKEY: 45 
ZKEY: 90 
NUMLOCKKEY: 144 
SCOLONKEY: 186 
SLASHKEY: 191 
NUMPLUSKEY: 107 
F10KEY: 121 
F8KEY: 119 
F6KEY: 117 
WKEY: 87 
RETURNKEY: 13 
TKEY: 84 
SKEY: 83 
MKEY: 77 
KKEY: 75 
JKEY: 74 
AKEY: 65 
NINEKEY: 57 
SIXKEY: 54 
FOURKEY: 52 
ZEROKEY: 48 
CAPSLOCKKEY: 20 
PRINTKEY: 42 
ALTKEY: 18 
TABKEY: 9 
FKEY: 70 
HOMEKEY: 36 
ENTERKEY: 13 
PAGEDOWNKEY: 34 
OKEY: 79 
F11KEY: 122 
VKEY: 86 
UKEY: 85 
NUMMINUSKEY: 109 
NKEY: 78 
GKEY: 71 
EIGHTKEY: 56 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment