Difference between revisions of "Disk eject (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created event page.)
 
(links, cleanup and better coding habits)
 
(One intermediate revision 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=disk_eject
 
|name=disk_eject
|desc=Fired when a disk is removed from any connected (directly adjacent to) disk drive.
+
|desc=Fired when a [[Floppy Disk]] is removed into any [[Disk Drive]] connected to the computer locally or remotely (over Network Cables).
|return1=The [[String_(type)|String]] value of the side of the disk drive.
+
|return1=The [[String_(type)|String]] value of the side/name of the [[Disk Drive]].
 +
}}
 +
{{Example
 +
|desc=Notifies the user when a disk is removed from a connected disk drive
 +
|code=while true do
 +
  local event, side = os.pullEvent()
 +
  if event == "disk_eject" then
 +
    print("Disk was removed from: "..side)
 +
  end
 +
end
 
}}
 
}}

Latest revision as of 10:06, 28 October 2013



Grid Modem.png  Event disk_eject
Fired when a Floppy Disk is removed into any Disk Drive connected to the computer locally or remotely (over Network Cables).
Returned Object 1 The String value of the side/name of the Disk Drive.


Grid paper.png  Example
Notifies the user when a disk is removed from a connected disk drive
Code
while true do
  local event, side = os.pullEvent()
  if event == "disk_eject" then
    print("Disk was removed from: "..side)
  end
end