Difference between revisions of "Key (event)"
From ComputerCraft Wiki
m (Codefix.) |
(Add note about scan codes; note escape is not seen; remove needswork banner as an example has, in fact, been added earlier) |
||
| Line 1: | Line 1: | ||
| − | |||
| − | |||
{{Event | {{Event | ||
|name=key | |name=key | ||
| − | |desc=Fired when any key is pressed while the terminal is focused. | + | |desc=Fired when any key except Escape is pressed while the terminal is focused. |
| − | |return1=The numerical key value of the key pressed | + | |return1=The numerical key value of the key pressed |
}} | }} | ||
{{Example | {{Example | ||
| Line 15: | Line 13: | ||
|output=Any key that is pressed. | |output=Any key that is pressed. | ||
}} | }} | ||
| + | |||
==Key scan codes == | ==Key scan codes == | ||
[[File:CC-Keyboard-Charcodes.png|center|frame|250x250px|Click for a larger copy of this image - contains keys and their event numbers.]] | [[File:CC-Keyboard-Charcodes.png|center|frame|250x250px|Click for a larger copy of this image - contains keys and their event numbers.]] | ||
| + | |||
| + | These scan codes are also available as constants in the [[Keys (API)|keys API]], and can be translated from numerical codes to strings using [[keys.getName]]. | ||
Revision as of 23:18, 5 May 2013
| Fired when any key except Escape is pressed while the terminal is focused. | |
| Returned Object 1 | The numerical key value of the key pressed |
Key scan codes
These scan codes are also available as constants in the keys API, and can be translated from numerical codes to strings using keys.getName.
