Char (event)

From ComputerCraft Wiki
Revision as of 02:27, 9 January 2013 by Keeree (Talk | contribs) (Added example.)

Jump to: navigation, search
This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: A demonstration on the use and handling of this event would be beneficial. AfterLifeLochie 16:09, 30 November 2012 (MSK))



Grid Modem.png  Event char
Fired when a alphanumeric key is pressed on the keyboard.
Returned Object 1 The String representing the character that was pressed.


Grid paper.png  Example
Prints out the character that was pressed.
Code
while true do
  event, character = os.pullEvent("char")
  print(character.." was pressed.")
end
Output The key that was pressed. Note this doesn't trigger for Tab, Shift, the up arrow, etc. Use the key event if you wish to trap those keys.