key up (event)

From ComputerCraft Wiki
Revision as of 11:31, 28 June 2015 by MKlegoman357 (Talk | contribs) (Created page with "{{Lowercase}} {{Event |name=key_up |desc=Fired when any key except Escape is released while the terminal is focused. |return1=The numerical key value of the key released }} {{...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Grid Modem.png  Event key_up
Fired when any key except Escape is released while the terminal is focused.
Returned Object 1 The numerical key value of the key released


Grid paper.png  Example
Print each key released on the keyboard whenever a "key_up" event is fired. Use Ctrl+T (Windows) to terminate the loop.
Code
while true do
  local event, key = os.pullEvent("key_up")
  
  print( keys.getName( key ), " was released." )
end
Output Any key that is released.



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.

Click for a larger copy of this image - contains keys and their event numbers.