Difference between revisions of "Redstone (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created event page)
 
(Adding Example code)
Line 4: Line 4:
 
|name=redstone
 
|name=redstone
 
|desc=Fired when any Redstone inputs change on any of the sides of the computer.
 
|desc=Fired when any Redstone inputs change on any of the sides of the computer.
 +
}}
 +
{{Example
 +
|desc=Alerts via console output when a redstone input changes.
 +
|code=
 +
while true do
 +
  event = os.pullEvent("redstone")
 +
  print("Redstone input changed.")
 +
end
 +
|output=This will tell one when the redstone event is triggered. Note this doesn't tell you the side of the event.
 
}}
 
}}

Revision as of 05:46, 9 January 2013

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



Grid Modem.png  Event redstone
Fired when any Redstone inputs change on any of the sides of the computer.
Returned Object 1 Nothing


Grid paper.png  Example
Alerts via console output when a redstone input changes.
Code
while true do
  event = os.pullEvent("redstone")
  print("Redstone input changed.")
end
Output This will tell one when the redstone event is triggered. Note this doesn't tell you the side of the event.