Difference between revisions of "Peripheral.getType"

From ComputerCraft Wiki
Jump to: navigation, search
(Added page for peripheral.getType)
 
Line 11: Line 11:
 
|desc=Prints what has been attached to the computer or turtle's right side.
 
|desc=Prints what has been attached to the computer or turtle's right side.
 
|code=print(peripheral.getType("right"))
 
|code=print(peripheral.getType("right"))
|output=Either "[[modem]]", "[[computer]]", "[[turtle]]", "[[Disk Drive|drive]]", or nil if nothing was detected on the computer's right side.
+
|output=Either "[[modem]]", "[[computer]]", "[[turtle]]", "[[Disk Drive|drive]]", "[[monitor]]", or nil if nothing was detected on the computer's right side.
 
}}
 
}}
  
 
}}
 
}}

Revision as of 23:14, 6 October 2012


Grid Redstone.png  Function peripheral.isPresent
Tells you what is attached to a side of a computer.
Syntax peripheral.isPresent((string) side)
Returns (string) the type of peripheral that is present on side, or nil if nothing was found.
Part of ComputerCraft
API peripheral

Examples

Grid paper.png  Example
Prints what has been attached to the computer or turtle's right side.
Code
print(peripheral.getType("right"))
Output Either "modem", "computer", "turtle", "drive", "monitor", or nil if nothing was detected on the computer's right side.