alarm (event)
From ComputerCraft Wiki
Event alarm | |
Fired when an alarm has expired. | |
Returned Object 1 | The alarm's numerical representation value (returned when os.setAlarm() is initially called). |
Examples
Example | |
Sets the alarm at 7.00 (in-game) hour, then waits for the event to fire. | |
Code |
local alarmID = os.setAlarm(7) -- Sets the Alarm at 7.00 while true do local event, id = os.pullEvent("alarm") -- Waits for the alarm event if id == alarmID then -- Checks to see if it's the alarm we created print("The alarm has gone off!") break -- Get out of the loop end end |