Difference between revisions of "Disk (event)"

From ComputerCraft Wiki
Jump to: navigation, search
m (Changed output.)
(Changed example description to match new example code)
Line 5: Line 5:
 
}}
 
}}
 
{{Example
 
{{Example
|desc=Play any music disk put into a connected disk drive, and print the title.
+
|desc=Print a message when a disk is inserted into a connected disk drive.
 
|code=
 
|code=
 
  while true do
 
  while true do

Revision as of 22:20, 12 May 2013



Grid Modem.png  Event disk
Fired when a disk is inserted into any connected (directly adjacent to) disk drive.
Returned Object 1 The String value of the side of the disk drive.


Grid paper.png  Example
Print a message when a disk is inserted into a connected disk drive.
Code
while true do
  event, side = os.pullEvent("disk")
  if event == "disk" then
    print("Disk has been inserted")
  end
end
Output Notification once the disk has been inserted.