19 posts
Posted 25 July 2013 - 11:38 AM
is there any faster way I can wrap peripherals to a array or is typing them out the fastest way I can do it?
I'm trying to get the power in all my redstone energy cells as one value to keep a eye on how much power I have. I have 30 cells to check is the reason I'm asking.
1688 posts
Location
'MURICA
Posted 25 July 2013 - 11:47 AM
I assume your 30 cells are all connected via wired peripheral cables, and if so, you can use a loop with modem.getNames().
--# replace "back" with the side of your modem
local names = peripheral.call('back', 'getNames')
local cells = {}
for i=1, #names do
table.insert(cells, peripheral.wrap(names[i]))
end
19 posts
Posted 31 July 2013 - 11:19 AM
its saying getNames doesnt exist
(sorry been sorry so havent been able to get back)
8543 posts
Posted 31 July 2013 - 12:34 PM
It's getNamesRemote. I'm fairly certain you could replace the whole peripheral.call with a peripheral.getNames() (though that would also give you the modem, not just the remote peripherals).