Disk (API)
From ComputerCraft Wiki
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”).
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. |