This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Eric's profile picture

Deprecate the disk API

Started by Eric, 20 January 2013 - 12:53 PM
Eric #1
Posted 20 January 2013 - 01:53 PM
Why do we need the disk api when the peripheral.wrap API does everything, and more concisely? Instead of:


local t = disk.getAudioTitle('top')
print(t)
disk.playAudio('top')
sleep()
disk.eject('top')

We can already do:

local record = peripheral.wrap('top')
local t = record.getAudioTitle()
print(t)
record.playAudio()
sleep()
record.eject()

And that way we don't have 'top' littered all over the code.
theoriginalbit #2
Posted 20 January 2013 - 02:01 PM
because its easier to type disk.getMountPath("left") than having to wrap the peripheral to a side to then query it… if its really required that you don't want to have a string littered all over the code just search for the disk drive, store the side in a variable, then use that variable all over the place…
Cloudy #3
Posted 20 January 2013 - 02:04 PM
It's for convenience reasons - disks work somewhat differently to most other peripherals.
Eric #4
Posted 20 January 2013 - 02:07 PM
because its easier to type disk.getMountPath("left") than having to wrap the peripheral to a side to then query it… if its really required that you don't want to have a string littered all over the code just search for the disk drive, store the side in a variable, then use that variable all over the place…
Fair enough, hadn't though of the quick single line case. Even so, seems largely redundant, and is inconsistent with how printers are used.