Posted 27 March 2016 - 06:11 AM
Hey Pros!
So a buddy and i, have been playing around for an auto wrapper for turbines and monitors, but when we plug the monitor into the system, it gives us error: 36:attempt to call nill
Code:
Any help is appreciated! :)/>
//Plazter
EDIT: the "(b )/>" is done by the editor.. dno why we use "(b )"
EDIT 2#:
is returning a "attempt to call nill" error, really cant see where its going wrong :(/> (if you read before i edited the edited the edited version, we have some snipped out part in the code ingame, typed without thinking :P/>)
So a buddy and i, have been playing around for an auto wrapper for turbines and monitors, but when we plug the monitor into the system, it gives us error: 36:attempt to call nill
Code:
Spoiler
turbines = {}
monitors = {}
local function isMonitor(B)/>/>/>/>/>
return b == "left"
or b == "right"
or b == "front"
or b == "back"
or b == "top"
or b == "bottom"
--or peripheral.getType(B)/>/>/>/>/> == "monitor"
end
print("Found devices: ")
-- Searches for devices
for a,b in ipairs(peripheral.getNames()) do
-- prints the devices
print(a ..": ".. B)/>/>/>/>/>
-- if element is a turbine or a monitor
if peripheral.getType(B)/>/>/>/>/> == "BigReactors-Turbine" then
table.insert(turbines, peripheral.wrap(B)/>/>/>/>/>)
elseif isMonitor(B)/>/>/>/>/> then
table.insert(monitors, peripheral.wrap(B)/>/>/>/>/>)
print("Monitor found ("..a..")")
end
end
for i=1, #monitors do
monitors[i].clear()
monitors[i].write("*")
end
Any help is appreciated! :)/>
//Plazter
EDIT: the "(b )/>" is done by the editor.. dno why we use "(b )"
EDIT 2#:
turbines = {peripheral.find("BigReactors-Turbine")}
monitors = {peripheral.find("monitor")}
for i=1, #monitors do
monitors[i].clear()
monitors[i].write("*")
end
print ("Amount of turbines found: "..table.getn(turbines).."\n")
for i = 1, #turbines do
monitors[1].write(turbines[1].getActive())
end
Line 10: "monitors[1].write(turbines[1].getActive())is returning a "attempt to call nill" error, really cant see where its going wrong :(/> (if you read before i edited the edited the edited version, we have some snipped out part in the code ingame, typed without thinking :P/>)
Edited on 27 March 2016 - 05:07 AM