Modem.getNamesRemote
From ComputerCraft Wiki
Revision as of 14:12, 9 January 2016 by Bomb Bloke (Talk | contribs) (Created page with "{{Function |name=''modem''.getNamesRemote |returns={{type|table}} peripheralNames |api=Modem |addon=ComputerCraft |desc=Essentially the same as peripheral.getNames(), whic...")
| 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
| 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". |