Reference for keyboard.lua Module 🔗
local keyboard = require("keyboard")
Use these codes to refer to the corresponding keys. That is, if you need the key code for K
, write in keyboard.k
. The actual key code is available here, but you probably shouldn’t use the number itself in your code.
Letters 🔗
keyboard.a
Code: 65keyboard.b
Code: 66keyboard.c
Code: 67keyboard.d
Code: 68keyboard.e
Code: 69keyboard.f
Code: 70keyboard.g
Code: 71keyboard.h
Code: 72keyboard.i
Code: 73keyboard.j
Code: 74keyboard.k
Code: 75keyboard.l
Code: 76keyboard.m
Code: 77keyboard.n
Code: 78keyboard.o
Code: 79keyboard.p
Code: 80keyboard.q
Code: 81keyboard.r
Code: 82keyboard.s
Code: 83keyboard.t
Code: 84keyboard.u
Code: 85keyboard.v
Code: 86keyboard.w
Code: 87keyboard.x
Code: 88keyboard.y
Code: 89keyboard.z
Code: 90Numbers above Letters 🔗
keyboard.zero
Code: 48keyboard.one
Code: 49keyboard.two
Code: 50keyboard.three
Code: 51keyboard.four
Code: 52keyboard.five
Code: 53keyboard.six
Code: 54keyboard.seven
Code: 55keyboard.eight
Code: 56keyboard.nine
Code: 57Miscellaneous Keys 🔗
keyboard.backspace
Code: 214keyboard.tab
Code: 211keyboard.enter
Code: 208keyboard.escape
Code: 210keyboard.esc
Code: 210keyboard.delete
Code: 217keyboard.numlockMinus
Code: 173keyboard.numlockPlus
Code: 171keyboard.numlockSlash
Code: 175keyboard.numlockStar
Code: 170keyboard.numlockAsterisk
Code: 170Arrows and Directions 🔗
keyboard.up
Code: 192keyboard.north
Code: 192keyboard.right
Code: 195keyboard.east
Code: 195keyboard.down
Code: 193keyboard.south
Code: 193keyboard.left
Code: 194keyboard.west
Code: 194keyboard.northEast
Code: 197keyboard.pageUp
Code: 197keyboard.southEast
Code: 198keyboard.pageDown
Code: 198keyboard.southWest
Code: 199keyboard.endKey
Code: 199keyboard.northWest
Code: 196keyboard.home
Code: 196Number Pad Numbers 🔗
keyboard.numlock0
Code: 160keyboard.numlock1
Code: 161keyboard.numlock2
Code: 162keyboard.numlock3
Code: 163keyboard.numlock4
Code: 164keyboard.numlock5
Code: 165keyboard.numlock6
Code: 166keyboard.numlock7
Code: 167keyboard.numlock8
Code: 168keyboard.numlock9
Code: 169F Keys 🔗
keyboard.F1
Code: 176keyboard.F2
Code: 177keyboard.F3
Code: 178keyboard.F4
Code: 179keyboard.F5
Code: 180keyboard.F6
Code: 181keyboard.F7
Code: 182keyboard.F8
Code: 183keyboard.F9
Code: 184keyboard.F11
Code: 186keyboard.F12
Code: 187Shift and Ctrl 🔗
The Shift and Control keys modify the other keys, by adding 256
and 512
, respectively, to the key codes.
If you reference a key by
keyboard.keyName
Then, to get the ID of that key when Shift is held down, write
keyboard.shift.keyName
Similarly, to get the ID of a key when Ctrl is held down, write
keyboard.ctrl.keyName
For Ctrl and Shift at the same time, you can use either of these commands:
keyboard.ctrl.shift.keyName
keyboard.shift.ctrl.keyName
If you happen to need the value for Shift or Ctrl itself, use these: