Difference between revisions of "Keys (API)"
From ComputerCraft Wiki
Smiley43210 (Talk | contribs) m (Added type) |
(Add return type column) |
||
Line 2: | Line 2: | ||
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> | <table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> | ||
− | <tr><td colspan=" | + | <tr><td colspan="3" style="font-weight: bold; font-size: large; padding-bottom: .3em; border-bottom: solid #C9C9C9 1px; background: #D3FFC2; line-height:28px;"> |
[[File:Grid_disk.png|24px]] | [[File:Grid_disk.png|24px]] | ||
keys (API) | keys (API) | ||
</td></tr> | </td></tr> | ||
− | <tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | + | <tr><td style="width: 100px; background: #E0E0E0; padding: .4em; font-weight:bold;">Return</td><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> |
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[keys.getName]]({{type|int}} code)</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{type|string}} keyName</td> |
+ | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[keys.getName]]({{type|int}} code)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Translates a numerical key code to a human-readable name.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Translates a numerical key code to a human-readable name.</td></tr> | ||
Revision as of 23:19, 5 May 2013
The Keys API provides a table of numerical codes corresponding to keyboard keys, suitable for decoding key events.
Return | Method Name | Description |
string keyName | keys.getName(int code) | Translates a numerical key code to a human-readable name. |
Although this API contains only one method, it also contains a vast number of constants, one per key, containing the numerical key codes for those keys. As of ComputerCraft 1.52, the following constants are defined:
- 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