disk.hasData

From ComputerCraft
Jump to: navigation, search

disk.hasData
Function
Syntax
disk.hasData(
  • side or network name : string
)

Returns boolean result
API disk
Source CC:Tweaked (source)

Checks if a disk drive has an item attached, and if that item is a floppy disk.

ExampleExampleIs there a disk?
Check if a floppy disk is present in the top disk drive.
Code
if disk.hasData("top") then
  print("The top disk drive contains a floppy disk!");
else
  print("There is no floppy disk present in the top disk drive!");
end
Output If a floppy disk is present in the top disk drive it says so, otherwise it says there are no floppy disks present.