Difference between revisions of "Disk (API)"
From ComputerCraft Wiki
(Add return values, update descriptions to match function pages, and use type template) |
m (Fix template transclusion) |
||
Line 11: | Line 11: | ||
<tr><td style="width: 100px; background: #E0E0E0; padding: .4em; font-weight:bold;">Return</td><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: 100px; background: #E0E0E0; padding: .4em; font-weight:bold;">Return</td><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;">{{Type|boolean} present</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|boolean}} present</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.isPresent|disk.isPresent]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.isPresent|disk.isPresent]]({{Type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether any item at all is in the disk drive.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Checks whether any item at all is in the disk drive.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|boolean} disk</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|boolean}} disk</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasData|disk.hasData]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasData|disk.hasData]]({{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 disc] or other item.</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 disc] or other item.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string} path, or [[nil]]</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string}} path, or [[nil]]</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getMountPath|disk.getMountPath]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getMountPath|disk.getMountPath]]({{Type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds the directory name on the local computer where the contents of the Floppy Disk currently inserted in the drive can be found.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Finds the directory name on the local computer where the contents of the Floppy Disk currently inserted in the drive can be found.</td></tr> | ||
Line 27: | Line 27: | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Writes a label to the floppy disk, which can be read with [[disk.getLabel]] and viewed in the item tooltip.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Writes a label to the floppy disk, which can be read with [[disk.getLabel]] and viewed in the item tooltip.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string} label</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string}} label</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getLabel|disk.getLabel]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getLabel|disk.getLabel]]({{Type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Reads the label from the disk in the drive.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Reads the label from the disk in the drive.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|int} id</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|int}} id</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getID|disk.getID]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getID|disk.getID]]({{Type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a number which uniquely identifies the disk in the drive and which is the name of the directory in the world’s <code>computer/disk</code> directory containing the disk’s data.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Returns a number which uniquely identifies the disk in the drive and which is the name of the directory in the world’s <code>computer/disk</code> directory containing the disk’s data.</td></tr> | ||
− | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|boolean} audio</td> | + | <tr style="background-color: #FFFFFF;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|boolean}} audio</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasAudio|disk.hasAudio]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.hasAudio|disk.hasAudio]]({{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]] or other item.</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]] or other item.</td></tr> | ||
− | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string} title</td> | + | <tr style="background-color: #E8E8E8;"><td style="border-top: solid #C9C9C9 1px; padding: .4em;">{{Type|string}} title</td> |
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getAudioTitle|disk.getAudioTitle]]({{Type|string}} side)</td> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">[[disk.getAudioTitle|disk.getAudioTitle]]({{Type|string}} side)</td> | ||
<td style="border-top: solid #C9C9C9 1px; padding: .4em;">Reads the title of the audio track from the music record in the drive.</td></tr> | <td style="border-top: solid #C9C9C9 1px; padding: .4em;">Reads the title of the audio track from the music record in the drive.</td></tr> | ||
Line 57: | Line 57: | ||
[[Category:APIs]] | [[Category:APIs]] | ||
+ | /td> |
Revision as of 19:08, 22 April 2013
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>