Difference between revisions of "Peripheral detach (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created event page)
 
(updated to match peripheral event page)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{NeedsWork|A demonstration on the use and handling of this event would be beneficial. ''[[User:AfterLifeLochie|AfterLifeLochie]] 16:13, 30 November 2012 (MSK)''}}
 
 
 
{{Event
 
{{Event
 
|name=peripheral_detach
 
|name=peripheral_detach
|desc=Fired when a peripheral is disconnected (directly adjacent) from the computer.
+
|desc=Fired when a peripheral is disconnected from the computer locally or remotely (over Network Cables).
|return1=The [[String_(type)|String]] value of the side of the now-disconnected peripheral.
+
|return1=The [[String_(type)|string]] of the side/name of the now disconnected peripheral.
 +
}}
 +
 
 +
{{Example
 +
|desc=Prints the side/name of a peripheral when it's disconnected
 +
|code=
 +
while true do
 +
  local event, side = os.pullEvent("peripheral_detach")
 +
  print("The peripheral ", side, " has been disconnected")
 +
end
 
}}
 
}}

Latest revision as of 11:18, 25 March 2014



Grid Modem.png  Event peripheral_detach
Fired when a peripheral is disconnected from the computer locally or remotely (over Network Cables).
Returned Object 1 The string of the side/name of the now disconnected peripheral.


Grid paper.png  Example
Prints the side/name of a peripheral when it's disconnected
Code
while true do
  local event, side = os.pullEvent("peripheral_detach")
  print("The peripheral ", side, " has been disconnected")
end