drive

Disk drives are a peripheral which allow you to read and write to floppy disks and other "mountable media" (such as computers or turtles). They also allow you to play records.

When a disk drive attaches some mount (such as a floppy disk or computer), it attaches a folder called disk, disk2, etc... to the root directory of the computer. This folder can be used to interact with the files on that disk.

When a disk is inserted, a disk event is fired, with the side peripheral is on. Likewise, when the disk is detached, a disk_eject event is fired.

stopAudio()Stops any audio that may be playing.
isDiskPresent()Returns whether a disk is currently inserted in the drive.
getAudioTitle()Returns the title of the inserted audio disk.
ejectDisk()Ejects any disk that may be in the drive.
hasData()Returns whether a disk with data is inserted.
hasAudio()Returns whether a disk with audio is inserted.
setDiskLabel([labelA])Sets or clears the label for a disk.
getDiskID()Returns the ID of the disk inserted in the drive.
getMountPath()Returns the mount path for the inserted disk.
playAudio()Plays the audio in the inserted disk, if available.
getDiskLabel()Returns the label of the disk in the drive if available.
stopAudio()Source

Stops any audio that may be playing.

See also

isDiskPresent()Source

Returns whether a disk is currently inserted in the drive.

Returns

  1. boolean Whether a disk is currently inserted in the drive.
getAudioTitle()Source

Returns the title of the inserted audio disk.

Returns

  1. any | nil The title of the audio, or nil if no audio disk is inserted.
ejectDisk()Source

Ejects any disk that may be in the drive.

hasData()Source

Returns whether a disk with data is inserted.

Returns

  1. boolean Whether a disk with data is inserted.
hasAudio()Source

Returns whether a disk with audio is inserted.

Returns

  1. boolean Whether a disk with audio is inserted.
setDiskLabel([labelA])Source

Sets or clears the label for a disk.

If no label or nil is passed, the label will be cleared.

If the inserted disk's label can't be changed (for example, a record), an error will be thrown.

Parameters

  1. labelA? string The new label of the disk, or nil to clear.

Throws

  • If the disk's label can't be changed.

getDiskID()Source

Returns the ID of the disk inserted in the drive.

Returns

  1. number The The ID of the disk in the drive, or nil if no disk with an ID is inserted.
getMountPath()Source

Returns the mount path for the inserted disk.

Returns

  1. string | nil The mount path for the disk, or nil if no data disk is inserted.
playAudio()Source

Plays the audio in the inserted disk, if available.

getDiskLabel()Source

Returns the label of the disk in the drive if available.

Returns

  1. string The label of the disk, or nil if either no disk is inserted or the disk doesn't have a label.