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

[1.46] disk.getSerial() broken

Started by GopherAtl, 10 November 2012 - 07:38 AM
GopherAtl #1
Posted 10 November 2012 - 08:38 AM
disk.getSerial() trys to call the function getSerial on the drive peripheral, but the drive peripheral doesn't have getSerial, it has getDiskID.

You could "patch" the issue by adding this to your startup file:


disk.getSerial=function(sSide)
  if peripheral.getType(sSide)=="drive" then
    return peripheral.call(sSide,"getDiskID")
  end
  return nil
end

rom/apis/disk can be fixed basically the same way, though it can use the disk api's local isDrive function instead of calling peripheral.getType directly.
ElvishJerricco #2
Posted 10 November 2012 - 10:01 AM
How is this a bug or an issue? The wiki never mentions a function called getSerial, but it does have an entry for getDiskID. This is intended behavior.
Cloudy #3
Posted 10 November 2012 - 11:36 AM
Fixed by removing the function that doesn't work.

Although in all fairness, this is just a small Lua side bug - and a throwback to when I implemented it with the name getSerial.