Does peripheral.getNames just use rs.getSides, then if it's a wired modem lists it's remote peripherals? I'm trying to sandbox it, so I need help.
[Solved] peripheral.getNames?
Started by MudkipTheEpic, May 11 2013 01:42 PM
2 replies to this topic
#1
Posted 11 May 2013 - 01:42 PM
#2
Posted 11 May 2013 - 01:48 PM
From the API section in your copy of CC/lua:
- native.someFunc is a built-in function
I know for a matter of fact you can program so you can figure out the code
If not, just ask
local native = peripheral
function getNames()
local tResults = {}
for n,sSide in ipairs( rs.getSides() ) do
if native.isPresent( sSide ) then
table.insert( tResults, sSide )
if native.getType( sSide ) == "modem" and not native.call( sSide, "isWireless" ) then
local tRemote = native.call( sSide, "getNamesRemote" )
for n,sName in ipairs( tRemote ) do
table.insert( tResults, sName )
end
end
end
end
return tResults
end
Things you should know with figuring out this code: - native.someFunc is a built-in function
I know for a matter of fact you can program so you can figure out the code
If not, just ask
#3
Posted 11 May 2013 - 01:52 PM
That is the exact same thing I expected it to be, thanks for confirming.
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











