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

Title: Description Maker For Floppy Disks

Started by DannySMc, 20 July 2013 - 12:01 PM
DannySMc #1
Posted 20 July 2013 - 02:01 PM
I am trying to make a simple program that will set the discs description. I have the following:

local drive_side = "bottom" -- Choose the side your drive is on
disk = peripheral.wrap(drive_side)
print("Description Maker V1.0")
print("----------------------")
sleep(1)
print("Type Description then Press Enter")
description = read()
disk.setLabel(drive_side, description)
print("Completed")

Help please :)/>
Engineer #2
Posted 20 July 2013 - 06:19 PM
You are redefining the disk API. Only this time it doesnt have the disk.setLabel function. So remove the second line of your code or rename disk on the second line.
Sample:

local drive_side = "bottom" -- Choose the side your drive is on
not_disk = peripheral.wrap(drive_side) -- Or remove this line, it is not needed.
print("Description Maker V1.0")
print("----------------------")
sleep(1)
print("Type Description then Press Enter")
description = read()
disk.setLabel(drive_side, description)
print("Completed")
Zudo #3
Posted 21 July 2013 - 02:42 AM
Lua is a "reprogrammable" language, so you can't expect an API to work when you create a global variable sharing it's name! -_-/>