Difference between revisions of "Disk eject (event)"

From ComputerCraft Wiki
Jump to: navigation, search
(Created event page.)
 
(Added an example with basic usage)
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 from any connected (directly adjacent) disk drive.
|return1=The [[String_(type)|String]] value of the side of the disk drive.
+
|return1=The [[String_(type)|String]] value of the side of the [[Disk Drive]].
 +
}}
 +
 
 +
{{Example
 +
|desc=Notifies the user when a Floppy Disk is removed from an adjacent Disk Drive. Press and hold Ctrl + T to terminate the program.
 +
|code=
 +
for e, p1 in os.pullEvent("disk_eject") do -- Each time the "disk_eject" event is fired, run the following code
 +
  print("A disk was ejected from the disk drive on the following side: " .. p1)
 +
end
 +
|output=Prints a message each time the "disk_eject" event is fired. It displays the side where the Disk Drive whose disk was ejected is located.
 
}}
 
}}

Revision as of 17:41, 11 April 2013



Grid Modem.png  Event disk_eject
Fired when a Floppy Disk is removed from any connected (directly adjacent) disk drive.
Returned Object 1 The String value of the side of the Disk Drive.


Grid paper.png  Example
Notifies the user when a Floppy Disk is removed from an adjacent Disk Drive. Press and hold Ctrl + T to terminate the program.
Code
for e, p1 in os.pullEvent("disk_eject") do -- Each time the "disk_eject" event is fired, run the following code
  print("A disk was ejected from the disk drive on the following side: " .. p1)
end
Output Prints a message each time the "disk_eject" event is fired. It displays the side where the Disk Drive whose disk was ejected is located.