Difference between revisions of "Key (event)"
From ComputerCraft Wiki
(Add note about scan codes; note escape is not seen; remove needswork banner as an example has, in fact, been added earlier) |
m (better coding habits) |
||
Line 8: | Line 8: | ||
|code= | |code= | ||
while true do | while true do | ||
− | event, scancode = os.pullEvent("key") | + | local event, scancode = os.pullEvent("key") |
print(tostring(scancode).." was pressed.") | print(tostring(scancode).." was pressed.") | ||
end | end |
Revision as of 09:31, 28 October 2013
Event key | |
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.