peripheral.wrap

From ComputerCraft Wiki
Jump to: navigation, search


Grid Redstone.png  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

Examples

Grid paper.png  Example
Shuts down the computer or turtle on the right side of the calling machine.
Code
local computer = peripheral.wrap("right")
computer.shutdown()
Output Shuts down any computer to the right of the computer/turtle.