Difference between revisions of "Disk (API)"
From ComputerCraft Wiki
(Updated to API overview v2) |
(Note local and remote side parameters and change incorrectly named function) |
||
Line 2: | Line 2: | ||
− | The Disk API allows you to interact with disk drives. | + | 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”). |
<table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> | <table style="width: 100%; border: solid 1px black; margin: 2px; border-spacing: 0px;"> | ||
Line 12: | Line 12: | ||
<tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | <tr><td style="width: 350px; background: #E0E0E0; padding: .4em; font-weight:bold;">Method Name</td><td style="background: #E0E0E0; padding: .4em; font-weight:bold;">Description</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.isPresent|disk.isPresent]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.isPresent|disk.isPresent]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks the given side for a disk</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks the given side for a disk</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasData|disk.hasData]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasData|disk.hasData]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether the current disk is a [[Floppy Disk|floppy disk]], as opposed to a [http://www.minecraftwiki.net/wiki/Music_Discs music disk].</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether the current disk is a [[Floppy Disk|floppy disk]], as opposed to a [http://www.minecraftwiki.net/wiki/Music_Discs music disk].</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getMountPath|disk.getMountPath]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getMountPath|disk.getMountPath]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the directory path on which the disk on '''side''' has been mount (ex. /disk)</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the directory path on which the disk on '''side''' has been mount (ex. /disk)</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.setLabel|disk.setLabel]]([[string (type)|string]] side, [[string (type)|string]] label )</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.setLabel|disk.setLabel]]([[string (type)|string]] side, [[string (type)|string]] label)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the label</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Sets the label</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getLabel|disk.getLabel]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getLabel|disk.getLabel]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds label</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds label</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk. | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getID|disk.getID]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds ID (unique for every disk)</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds ID (unique for every disk)</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasAudio|disk.hasAudio]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasAudio|disk.hasAudio]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether the current disk is a [http://www.minecraftwiki.net/wiki/Music_Discs music disk], as opposed to a [[Floppy Disk|floppy disk]].</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether the current disk is a [http://www.minecraftwiki.net/wiki/Music_Discs music disk], as opposed to a [[Floppy Disk|floppy disk]].</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getAudioTitle|disk.getAudioTitle]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getAudioTitle|disk.getAudioTitle]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the audio title on the disk</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns the audio title on the disk</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.playAudio|disk.playAudio]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.playAudio|disk.playAudio]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Plays the audio</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Plays the audio</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.stopAudio|disk.stopAudio]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.stopAudio|disk.stopAudio]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Stops the audio</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Stops the audio</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.eject|disk.eject]]([[string (type)|string]] side )</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.eject|disk.eject]]([[string (type)|string]] side)</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Ejects the disk.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Ejects the disk.</td></tr> | ||
</table> | </table> |
Revision as of 18:23, 21 April 2013
If you were looking for disks as in Floppies, go to 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”).
Method Name | Description |
disk.isPresent(string side) | Checks the given side for a disk |
disk.hasData(string side) | Checks whether the current disk is a floppy disk, as opposed to a music disk. |
disk.getMountPath(string side) | Returns the directory path on which the disk on side has been mount (ex. /disk) |
disk.setLabel(string side, string label) | Sets the label |
disk.getLabel(string side) | Finds label |
disk.getID(string side) | Finds ID (unique for every disk) |
disk.hasAudio(string side) | Checks whether the current disk is a music disk, as opposed to a floppy disk. |
disk.getAudioTitle(string side) | Returns the audio title on the disk |
disk.playAudio(string side) | Plays the audio |
disk.stopAudio(string side) | Stops the audio |
disk.eject(string side) | Ejects the disk. |