Difference between revisions of "Computer (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Added peripheral API message)
m (Recreated the page)
Line 1: Line 1:
 
{{PeripheralAPI}}
 
{{PeripheralAPI}}
{{Stub}}
+
<br/>
 +
The Computer API is a peripheral API that allows [[Computer|computers]] and [[Turtle|turtles]] to interact with other computers and turtles.
 +
<br/>
 +
''computer'' stands for the variable you [[peripheral.wrap|wrapped]] the computer to.
  
'''''computer'' stands for the variable you wrapped the computer to.'''
+
{{API table|Computer|image=Grid disk.png|2=
''Example:'' computer = peripheral.wrap( "top" )
+
  
{| class="wikitable"
+
{{API table/row
!Method name
+
|[[computer.turnOn|''computer''.turnOn]]()
!Description
+
|{{type|nil}}
|-
+
|Turns on the [[Computer]] or [[Turtle]].}}
|computer.turnOn()
+
 
|Turns on the Computer or Turtle.
+
{{API table/row
|-
+
|[[computer.shutdown|''computer''.shutdown]]()
|computer.shutdown()
+
|{{type|nil}}
|Shuts off the Computer or Turtle.
+
|Shuts off the [[Computer]] or [[Turtle]].}}
|-
+
 
|computer.reboot()
+
{{API table/row
|Reboots the Computer or Turtle.
+
|[[computer.reboot|''computer''.reboot]]()
|-
+
|{{type|nil}}
|computer.getID()
+
|Reboots the [[Computer]] or [[Turtle]].}}
|Gets the ID of the Computer or Turtle if it is running, otherwise returns nothing.
+
 
|}
+
{{API table/row
 +
|[[computer.getID|''computer''.getID]]()
 +
|{{type|number}} computerID
 +
|Gets the ID of the [[Computer]] or [[Turtle]].}}
 +
 
 +
}}
  
 
[[Category: Peripheral APIs]]
 
[[Category: Peripheral APIs]]

Revision as of 14:31, 9 April 2014

This API requires the use of a wrapped peripheral!
This API does not behave like a regular API, to use it you must first wrap the peripheral and call the methods on the wrapped object. For more information see this page.


The Computer API is a peripheral API that allows computers and turtles to interact with other computers and turtles.
computer stands for the variable you wrapped the computer to.

Grid disk.png  Computer (API)
Function Return values Description
computer.turnOn() nil Turns on the Computer or Turtle.
computer.shutdown() nil Shuts off the Computer or Turtle.
computer.reboot() nil Reboots the Computer or Turtle.
computer.getID() number computerID Gets the ID of the Computer or Turtle.