Timer (event)

From ComputerCraft Wiki
Revision as of 00:12, 8 July 2013 by AfterLifeLochie (Talk | contribs) (Not 'numerical representation', 'unique ID'. os.startTimer() returns an ID.)

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:11, 30 November 2012 (MSK))

Grid Modem.png  Event timer
Fired when a timer completes.
Returned Object 1 The timer's unique ID value (returned when os.startTimer() is called).

Grid paper.png  Example
This code will continuously start an internal timer and fire an event. If the event is not the timer, then it will break the loop
while true do
event = os.pullEvent()
if event == "timer" then
print("Too slow!")
print("Darn, you beat me!")