Disk (API)
From ComputerCraft Wiki
Revision as of 10:16, 22 May 2013 by Cranium (Talk | contribs) (Undo revision 5681 by Cranium (talk))
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”).
Return | Method Name | Description |
boolean present | disk.isPresent(string side) | Checks whether any item at all is in the disk drive. |
boolean disk | disk.hasData(string side) | Checks whether the current disk is a floppy disk, as opposed to a music disc or other item. |
string path, or nil | disk.getMountPath(string side) | Finds the directory name on the local computer where the contents of the Floppy Disk currently inserted in the drive can be found. |
nil | disk.setLabel(string side, string label) | Writes a label to the floppy disk, which can be read with disk.getLabel and viewed in the item tooltip. |
string label | disk.getLabel(string side) | Reads the label from the disk in the drive. |
int id | disk.getID(string side) | Returns a number which uniquely identifies the disk in the drive and which is the name of the directory in the world’s computer/disk directory containing the disk’s data. |
boolean audio | disk.hasAudio(string side) | Checks whether the current disk is a music disk, as opposed to a floppy disk or other item. |
string title | disk.getAudioTitle(string side) | Reads the title of the audio track from the music record in the drive. |
nil | disk.playAudio(string side) | Starts playing the music record in the drive. |
nil | disk.stopAudio(string side) | Stops the music record in the drive from playing, if it was started with disk.playAudio. |
nil | disk.eject(string side) | Ejects any item currently in the drive, spilling it into the world as a loose item. |
/td>