Difference between revisions of "Peripheral.wrap"
From ComputerCraft Wiki
KillaVanilla (Talk | contribs) (Added page for peripheral.wrap()) |
MKlegoman357 (Talk | contribs) m |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
{{Function | {{Function | ||
|name=peripheral.wrap | |name=peripheral.wrap | ||
− | |args= | + | |args= {{type|string}} side |
− | |returns= | + | |returns={{type|table}} handle with all functions a peripheral has |
|api=peripheral | |api=peripheral | ||
|addon=ComputerCraft | |addon=ComputerCraft | ||
− | |desc=Returns a | + | |desc=Returns a table containing functions pointing to the peripheral's methods, which can then be called as if using peripheral.call(side, method). If no peripheral is found at the specified side, returns {{type|nil}} instead. |
|examples= | |examples= | ||
{{Example | {{Example | ||
− | |desc= | + | |desc=Shuts down the computer or turtle on the right side of the calling machine. |
− | |code=local | + | |code= local computer = '''peripheral.wrap("right")''' |
+ | computer.shutdown() | ||
|output=Shuts down any computer to the right of the computer/turtle. | |output=Shuts down any computer to the right of the computer/turtle. | ||
}} | }} | ||
− | |||
}} | }} | ||
+ | |||
+ | [[Category:Lua_Core_Functions]] |
Latest revision as of 17:24, 10 April 2014
Function peripheral.wrap | |
Returns a table containing functions pointing to the peripheral's methods, which can then be called as if using peripheral.call(side, method). If no peripheral is found at the specified side, returns nil instead. | |
Syntax | peripheral.wrap(string side) |
Returns | table handle with all functions a peripheral has |
Part of | ComputerCraft |
API | peripheral |