Timer (event)

From ComputerCraft Wiki
Revision as of 12:40, 29 March 2013 by SuicidalSTDz (Talk | contribs) (May need more work)

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 numerical representation value (returned when os.startTimer() is initially 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
Code
while true do
os.startTimer(1)
event = os.pullEvent()
if event == "timer" then
print("Too slow!")
else
print("Darn, you beat me!")
break
end
end