Timer (event)
From ComputerCraft Wiki
Revision as of 19:52, 19 December 2013 by Bomb Bloke (Talk | contribs) (Page has an example, no longer needs a request for one.)
Event timer | |
Fired when a timer completes. | |
Returned Object 1 | The timer's unique ID value (returned when os.startTimer(), which triggers this event, is called). |
Example | |
This code will loop and refresh every 1 second. If the event that occurred was a not a timer (eg a key event from a keypress), the loop will complete. | |
Code |
while true do os.startTimer(1) local event = os.pullEvent() if event == "timer" then print("Too slow!") else print("You've beaten me!") break end end |