peripheral.getNames
From ComputerCraft Wiki
Function peripheral.getNames | |
Provides a list of all peripherals available. If a device is located directly next to the system, then its name will be listed as the side it is attached to. If a device is attached via a Wired Modem, then it'll be reported according to its name on the wired network. | |
Syntax | peripheral.getNames() |
Returns | A numerically indexed table of all peripherals present. |
Part of | ComputerCraft |
API | peripheral |
Examples
Example | |
Prints a list of all attached peripherals, along with their type (using peripheral.getType()). | |
Code |
local periList = peripheral.getNames() 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 modem attached as "left". |