peripheral.getNames

From ComputerCraft
Jump to navigation Jump to search

peripheral.getNames
Function
Syntax
peripheral.getNames()
Returns table
API peripheral
Source CC:Tweaked (source)

Returns the network names of all peripherals connected to the computer. You can pass these to peripheral.getType, peripheral.getMethods, peripheral.isPresent, and peripheral.wrap.

ExampleExampleList peripherals and types
Prints the network name and type of all connected peripherals.
Code
for _, name in pairs(peripheral.getNames()) do
    print(name, peripheral.getType(name))
end