Keys API

Constants

The Keys API has the following Constants which contains the numerical key code for the key:

  • a
  • b
  • c
  • d
  • e
  • f
  • g
  • h
  • i
  • j
  • k
  • l
  • m
  • n
  • o
  • p
  • q
  • r
  • s
  • t
  • u
  • v
  • w
  • x
  • y
  • z
  • one
  • two
  • three
  • four
  • five
  • six
  • seven
  • eight
  • nine
  • zero
  • minus
  • equals
  • backspace
  • tab
  • leftBracket
  • rightBracket
  • enter
  • leftCtrl
  • semiColon
  • apostrophe
  • grave
  • leftShift
  • backslash
  • comma
  • period
  • slash
  • rightShift
  • multiply
  • leftAlt
  • space
  • capsLock
  • f1
  • f2
  • f3
  • f4
  • f5
  • f6
  • f7
  • f8
  • f9
  • f10
  • numLock
  • scollLock
  • numPad7
  • numPad8
  • numPad9
  • numPadSubtract
  • numPad4
  • numPad5
  • numPad6
  • numPadAdd
  • numPad1
  • numPad2
  • numPad3
  • numPad0
  • numPadDecimal
  • f11
  • f12
  • f13
  • f14
  • f15
  • kana
  • convert
  • noconvert
  • yen
  • numPadEquals
  • cimcumflex
  • at
  • colon
  • underscore
  • kanji
  • stop
  • ax
  • numPadEnter
  • rightCtrl
  • numPadComma
  • numPadDivide
  • rightAlt
  • pause
  • home
  • up
  • pageUp
  • left
  • right
  • end
  • down
  • pageDown
  • insert
  • delete

Functions

Functionkeys.getName
Returns the key name of a numerical key code. Returns nil if the key code is not valid.
Syntax keys.getName(
  • keyCode : number
)
Returns string keyName
Part of CC:Tweaked (source)
API keys
ExampleGet a key name
Get the name for the key code 50 and print it.
Code
<nowiki>
print(keys.getName(50))
    </nowiki>
Output m
gollark: Or you might be influenced to choose certain products over others because of advertising.
gollark: Probably not. But if you get exposed to enough advertising your views can be swayed a bit.
gollark: Anyway, while Microsoft probably doesn't have much of a reason to use your account on something to spam Trump propaganda, their data might be leaked or something.
gollark: You are, realistically, not entirely unaffected by advertising.
gollark: Anyway, you can invoke "banner blindness" all you want, but *advertising is somewhat effective or there would not be massive spends on it*.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.