Difference between revisions of "Peripheral detach (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created event page)
 
Line 6: Line 6:
 
|return1=The [[String_(type)|String]] value of the side of the now-disconnected peripheral.
 
|return1=The [[String_(type)|String]] value of the side of the now-disconnected peripheral.
 
}}
 
}}
 +
 +
== Example ==
 +
 +
p = peripheral.wrap("right") --wraps the peripheral on the right side
 +
event, side =os.pullEvent("peripheral_detach") --wait's until the peripheral is disconnected (e.g. Destroyed)
 +
print(event) --print's the event name
 +
print(side) --print's the side where the Peripheral was

Revision as of 13:22, 11 March 2014

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 peripheral_detach
Fired when a peripheral is disconnected (directly adjacent) from the computer.
Returned Object 1 The String value of the side of the now-disconnected peripheral.


Example

p = peripheral.wrap("right") --wraps the peripheral on the right side
event, side =os.pullEvent("peripheral_detach") --wait's until the peripheral is disconnected (e.g. Destroyed)
print(event) --print's the event name
print(side) --print's the side where the Peripheral was