Modem.getNamesRemote
From ComputerCraft Wiki
Function modem.getNamesRemote | |
Essentially the same as peripheral.getNames(), which returns a numerically-indexed table containing the names of all peripherals attached to the system; however, this function only returns peripherals which are specifically connected to the Wired Modem you called it through. | |
Syntax | modem.getNamesRemote() |
Returns | table peripheralNames |
Part of | ComputerCraft |
API | Modem |
Examples
Example | |
Prints a list of all peripherals attached to a modem, along with their type. | |
Code |
local modem = peripheral.wrap("top") -- Or whatever side the modem is attached to. local periList = modem.getNamesRemote() for i = 1, #periList do print("I have a "..peripheral.getType(periList[i]).." attached as \""..periList[i].."\".") end |
Output | Depending on the peripherals available, along the lines of: I have a monitor attached as "monitor_0". |