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

[1.8.9][SSP] disk.getID() on pocket and computer return nil

Started by skypop, 15 October 2016 - 11:01 PM
skypop #1
Posted 16 October 2016 - 01:01 AM
VERSION:
minecraft 1.8.9
computercraft 1.79

DESCRIPTION:
When a computer or pocket-computer is inserted in disk drive, disk.getID(string side) return nil.
Same thing, when wrapping disk drive, function getDiskID() return nil.

By way of comparison disk.getLabel(string side) and getDiskLabel() works perfectly.

EXPECTED RESULT:
Gets the unique ID number.

REPRODUCTION STEPS:
Place a computer and disk drive. Insert a pocket computer (with or whitout label, files…)
Run lua :

testID = disk.getID("right")
print(tostring(testID)) -- nil
print(type(testID)) -- nil

_drive = peripheral.wrap("right")
testID = _drive.getDiskID("right")
print(tostring(testID)) -- nil
print(type(testID)) -- nil
Edited on 15 October 2016 - 11:12 PM
KingofGamesYami #2
Posted 16 October 2016 - 02:52 AM
This is not a bug, this is intended behavior. The wiki page even states:

Returns number the disk ID, or nil if the drive does not contain a Floppy Disk

In addition, the disk ID is completely seperate from computer IDs. You can have a disk of id 0 and a computer of id 0, which would be confusing for any program using the ID.
Bomb Bloke #3
Posted 16 October 2016 - 04:55 AM
Though, the wiki is more an unofficial recording of "how ComputerCraft works", as opposed to "Dan's official word on how ComputerCraft should work". I've no idea what his intentions were here.
skypop #4
Posted 16 October 2016 - 09:24 AM
This is not a bug, this is intended behavior. The wiki page even states:

The wiki detail the same thing about labels while disk.getLabel() and getDiskLabel() works.
string disk label, or nil if the item in the drive is neither a floppy disk nor a music record or if it is a floppy disk with no label
KingofGamesYami #5
Posted 16 October 2016 - 12:42 PM
That may be, but I would still not consider this a bug simply because a disk id is separate from a computer id. It would be confusing if multiple items could return the same value for what is supposedly a unique and unreplicable identifier.
skypop #6
Posted 16 October 2016 - 11:46 PM
That may not be a bug, but in my humble opinion this is a mistake.
In the present state multiple items return the same value (nil), it confusing computers, turtles and pocket computers…
I think this feature has been forgotten during the1.6 and 1.77 updates.