Difference between revisions of "Disk (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Undo revision 6291 by Shazz (talk) Sorry, mistook this for the API returned when wrapping to a disk drive.)
m (Changed casing of return values)
Line 6: Line 6:
  
 
{{API table/row|[[disk.isPresent]]({{type|string}} side)|{{type|boolean}} present|Checks whether any item is in a disk drive.|odd}}
 
{{API table/row|[[disk.isPresent]]({{type|string}} side)|{{type|boolean}} present|Checks whether any item is in a disk drive.|odd}}
{{API table/row|[[disk.hasData]]({{type|string}} side)|{{type|boolean}} hasdata|Checks whether a [[Floppy Disk]] is in a disk drive.|}}
+
{{API table/row|[[disk.hasData]]({{type|string}} side)|{{type|boolean}} hasData|Checks whether a [[Floppy Disk]] is in a disk drive.|}}
 
{{API table/row|[[disk.getMountPath]]({{type|string}} side)|{{type|string}}/{{type|nil}} path|Gets the directory name where the contents of the floppy disk can be accessed.|odd}}
 
{{API table/row|[[disk.getMountPath]]({{type|string}} side)|{{type|string}}/{{type|nil}} path|Gets the directory name where the contents of the floppy disk can be accessed.|odd}}
 
{{API table/row|[[disk.setLabel]]({{type|string}} side, {{type|string}} label)|{{type|nil}}|Sets the floppy disk's label.|}}
 
{{API table/row|[[disk.setLabel]]({{type|string}} side, {{type|string}} label)|{{type|nil}}|Sets the floppy disk's label.|}}
 
{{API table/row|[[disk.getLabel]]({{type|string}} side)|{{type|string}}/{{type|nil}} label|Gets the floppy disk's label.|odd}}
 
{{API table/row|[[disk.getLabel]]({{type|string}} side)|{{type|string}}/{{type|nil}} label|Gets the floppy disk's label.|odd}}
 
{{API table/row|[[disk.getID]]({{type|string}} side)|{{type|number}}/{{type|nil}} id|Gets the floppy disk's unique ID number.|}}
 
{{API table/row|[[disk.getID]]({{type|string}} side)|{{type|number}}/{{type|nil}} id|Gets the floppy disk's unique ID number.|}}
{{API table/row|[[disk.hasAudio]]({{type|string}} side)|{{type|boolean}} hasaudio|Checks whether a [http://www.minecraftwiki.net/wiki/Music_Discs music disk] is in the drive.|odd}}
+
{{API table/row|[[disk.hasAudio]]({{type|string}} side)|{{type|boolean}} hasAudio|Checks whether a [http://www.minecraftwiki.net/wiki/Music_Discs music disk] is in the drive.|odd}}
 
{{API table/row|[[disk.getAudioTitle]]({{type|string}} side)|{{type|string}}/{{type|nil}} title|Gets the title of the music disc in the drive.|}}
 
{{API table/row|[[disk.getAudioTitle]]({{type|string}} side)|{{type|string}}/{{type|nil}} title|Gets the title of the music disc in the drive.|}}
 
{{API table/row|[[disk.playAudio]]({{type|string}} side)|{{type|nil}}|Starts playing the music disc in the drive.|odd}}
 
{{API table/row|[[disk.playAudio]]({{type|string}} side)|{{type|nil}}|Starts playing the music disc in the drive.|odd}}

Revision as of 04:06, 20 March 2015

If you were looking for the item, please see Floppy Disk.

The Disk API allows you to interact with disk drives. These functions can operate on locally attached or remote disk drives. To use a locally attached drive, specify “side” as one of the six sides (e.g. “left”); to use a remote disk drive, specify its name as printed when enabling its modem (e.g. “drive_0”).

Grid disk.png  Disk (API)
Function Return values Description
disk.isPresent(string side) boolean present Checks whether any item is in a disk drive.
disk.hasData(string side) boolean hasData Checks whether a Floppy Disk is in a disk drive.
disk.getMountPath(string side) string/nil path Gets the directory name where the contents of the floppy disk can be accessed.
disk.setLabel(string side, string label) nil Sets the floppy disk's label.
disk.getLabel(string side) string/nil label Gets the floppy disk's label.
disk.getID(string side) number/nil id Gets the floppy disk's unique ID number.
disk.hasAudio(string side) boolean hasAudio Checks whether a music disk is in the drive.
disk.getAudioTitle(string side) string/nil title Gets the title of the music disc in the drive.
disk.playAudio(string side) nil Starts playing the music disc in the drive.
disk.stopAudio(string side) nil Stops playing the music disc in the drive.
disk.eject(string side) nil Ejects any item currently in the drive, spilling it into the world as a loose item.