Difference between revisions of "Peripheral (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Fixed example in "peripheral.wrap(side)" so that it shows how the method exposes the functions on the peripheral. Before, it was unclear because isPresent exists as a method in the peripheral API.)
(Love Adding machine)
Line 1: Line 1:
The peripheral API is for interacting with external [http://en.wikipedia.org/wiki/Peripheral peripherals], such as the disk drive and monitor.<br />
+
I want to share in this area I initiate when looking for the benefit of discount auto parts, they saved me 100s of dollars when I was getting my car back on the motorway form month, so I thought I'd restore the karma and give them a do away with on here. On the whole 'mark-down auto parts' time out to be anything but, and you end up spending over-the-odds concerning in reduced circumstances grade parts and yeah, that's no longer a mistake I can provide to up, who can in this restraint, right? So, rpm-motots-inc.com are different, like extraordinarily, indeed different. Earliest up, the quotation you are quoted is the payment you satisfy, no cryptic extras. The parts I ordered were all in stock, were shipped stable and were fount packaged. I was amazed with the grade, predominantly for the weak price I paid, which was
[[Console|Consoles]] and [[Turtle|Turtles]] are also considered peripherals and you can interface two adjacent computers, although in a more limited fashion compared to [[Rednet (API)|rednet]]. Both Computers and Turtles provide the same methods: ''turnOn'', ''shutdown'', ''reboot'', ''getID''.
+
$391 cheaper than the popular diminish auto parts sites. I had a scarcely any questions in front I ordered and the crook I spoke to were bloody beneficial, and knew their stuff. Their customer handling and range of parts is stirring, rpm motors certainly nurture their promises when it comes to minimize auto parts.
 
+
==Methods==
+
{| border="1" cellpadding="2" cellspacing="0"
+
!style="background:#EEE" width="210px"|Method name
+
!style="background:#EEE" width="*"|Description
+
|-
+
|[[peripheral.isPresent]]( side )
+
|Returns '''true''' if a peripheral is present on ''side''.
+
|-
+
|[[peripheral.getType]]( side )
+
|Returns the type or peripheral present on ''side'', nothing returned if ''side'' is empty.
+
|-
+
|[[peripheral.getMethods]]( side )
+
|Returns a table containing all methods for peripheral on ''side''.
+
|-
+
|[[peripheral.call]]( side, methodName, param1, param2, ... )
+
|Sends a function call to peripheral located on ''side''. Return values match those of called method.<br />
+
'''Note:''' ''methodName'' is a string.
+
|-
+
|[[peripheral.wrap]]( side )
+
|Returns a handle to the peripheral located on ''side''. If assigned to a variable, it can be used to call all methods available from that peripheral, as if calling '''peripheral.call()''', e.g.:<br />
+
fdd = peripheral.wrap("left")<br />
+
fdd.someMethod()<br />
+
''- is the same as -''<br />
+
peripheral.call("left","someMethod")
+
|}
+
 
+
==Events==
+
{| border="1" cellpadding="2" cellspacing="0"
+
!style="background:#EEE" width="210px"|Event name
+
!style="background:#EEE" width="*"|Description
+
!style="background:#EEE" width="*"|Parameters
+
|-
+
|peripheral
+
|Fired when peripheral is attached
+
|side
+
|-
+
|peripheral_detach
+
|Fired when peripheral is removed
+
|side
+
|}
+
 
+
[[Category:APIs]]
+

Revision as of 02:10, 4 July 2012

I want to share in this area I initiate when looking for the benefit of discount auto parts, they saved me 100s of dollars when I was getting my car back on the motorway form month, so I thought I'd restore the karma and give them a do away with on here. On the whole 'mark-down auto parts' time out to be anything but, and you end up spending over-the-odds concerning in reduced circumstances grade parts and yeah, that's no longer a mistake I can provide to up, who can in this restraint, right? So, rpm-motots-inc.com are different, like extraordinarily, indeed different. Earliest up, the quotation you are quoted is the payment you satisfy, no cryptic extras. The parts I ordered were all in stock, were shipped stable and were fount packaged. I was amazed with the grade, predominantly for the weak price I paid, which was $391 cheaper than the popular diminish auto parts sites. I had a scarcely any questions in front I ordered and the crook I spoke to were bloody beneficial, and knew their stuff. Their customer handling and range of parts is stirring, rpm motors certainly nurture their promises when it comes to minimize auto parts.