Difference between revisions of "Disk.hasData"

From ComputerCraft Wiki
Jump to: navigation, search
m (Corrected mapping from "Boolean" to "Boolean (type)")
(This does not check whether there is anything on the disk, rather what type of item is in the drive)
Line 4: Line 4:
 
|args=[[string (type)|string]] side
 
|args=[[string (type)|string]] side
 
|api=disk
 
|api=disk
|returns=[[boolean_(type)|boolean]] whether the disk has data
+
|returns=[[boolean_(type)|boolean]] whether the item is a floppy
 +
|desc=Checks whether the item in the drive is a [[Floppy Disk]].
 
|addon=ComputerCraft
 
|addon=ComputerCraft
 
|examples=
 
|examples=
 
{{Example
 
{{Example
|desc=Checks for data saved on the disk in the bottom drive
+
|desc=Checks for what is in the bottom drive
 
|code=print(disk.hasData("bottom"))
 
|code=print(disk.hasData("bottom"))
|output=true if the disk has saved data, otherwise false
+
|output=true if the item is a floppy, otherwise false
 
}}
 
}}
 
}}
 
}}
  
 
[[Category:API_Functions]]
 
[[Category:API_Functions]]

Revision as of 18:28, 21 April 2013


Grid Redstone.png  Function disk.hasData
Checks whether the item in the drive is a Floppy Disk.
Syntax disk.hasData(string side)
Returns boolean whether the item is a floppy
Part of ComputerCraft
API disk

Examples

Grid paper.png  Example
Checks for what is in the bottom drive
Code
print(disk.hasData("bottom"))
Output true if the item is a floppy, otherwise false