Posted 27 May 2016 - 09:35 AM
need help with the second half of the code
its supposed to wrap the reactors as a peripheral and then set a value as on or off depending on whether or not it is active
its supposed to wrap the reactors as a peripheral and then set a value as on or off depending on whether or not it is active
local reactors = {}
local function reactorSearch()
local names = peripheral.getNames()
local n = 0
local i, name
for i, name in pairs(names) do
if peripheral.getType(name) == "BigReactors-Reactor" then
reactors[n] = name
n = n + 1
else
--return null
end
end
end
--#TODO: fix this function (wrap and state)
-- #wrap each reactor in reactors{"BigReactors-Reactor_0",etc}
-- #then determine if the reactor is active and set reactor_X to "ON" or "OFF"
local function rA1()
for a,v in ipairs(reactors) do
reactors[v] = peripheral.wrap(reactors[v])
if reactors[v].getActive() == true then
reactors[v:sub(13)] = "ON"
else
reactors[v:sub(13)] = "OFF"
end
end
end
Edited on 27 May 2016 - 07:37 AM