FANDOM


Events are triggered when something happens in or outside the computer.

Use os.pullEvent() to hold the program until a system event occurs.

For example, to detect a redstone change connected to the computer:

r = os.pullEvent()

if r == "redstone" then -- If the event was a redstone change.

  --Do Something

end


To detect what side:

r, s = os.pullEvent()

r is the event and s is the side.


The possible events are:

Event Trigger Arguments
char Text is typed on the keyboard Letter typed
key Key is pressed on the keyboard Numerical keycode
timer Timeout started by os.startTimer() completed Value returned by startTimer()
raw Something updates the computer (redstone, text, so forth...) None
alarm Time passed to os.setAlarm() is reached Value returned by setAlarm()
redstone The state of any redstone input changes Side of the change

disk or disk_eject

Disk is inserted or removed from an adjacent disk drive. Side of the change

rednet_message

Received rednet message Value returned by rednet.receive()

(id of sender, message)

modem_message Received Modem message

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.