peripheral.find
From ComputerCraft Wiki
| Returns a handle to a peripheral of the supplied type that can then be used to call methods, as if using peripheral.call(side, method). The same handle is returned using peripheral.wrap(). Requires ComputerCraft 1.6 or later. | |
| Syntax | peripheral.find(string type) |
| Returns | table handle1, table handle2, ... handles to peripherals of the given type |
| Part of | ComputerCraft |
| API | peripheral |
Examples
| Finds a monitor and writes 'Hello' on it. | |
| Code |
local monitor = peripheral.find("monitor")
if monitor then
monitor.write("Hello")
end
|
| Output | If there is a monitor connected 'Hello' will be written on it. |