I have a Problem with my Nuclear Controller.
The Errorcode:
Quote
test2.lua:48: bad argument: int expected, got boolean
This Code works perfectly:
local cableSide = "back" local switch = colors.pink local heatmin = colors.white local heatmax = colors.red local hot = false local cold = false local onoff = false local function update() local hot = rs.testBundledInput(cableSide, heatmax) local cold = rs.testBundledInput(cableSide, heatmin) local onoff = rs.testBundledInput(cableSide, switch) term.setCursorPos(1, 1) term.clear() print (hot) print (cold) print (onoff) sleep(1) end update() while true do update() end
The another incomplete Code with mysterious error:
--CABLE SIDE-- local cableSide = "back" --side of computer the bundled cable is on --[[CABLES]]-- local heatmin = colors.white --input from heat sensor local heatmax = colors.red --input from heat sensor local poweron = colors.black --output to control the reactor local ice = colors.green --output to activate ice local switch = colors.pink --switch turn on off reaktor local flow = colors.purple --input energy flow local danger = colors.lime --output for alarm local two = colors.orange --empty local companyName = "mieper Industries" --END OF CONFIG-- --start variables local heatmax = false local heatmin = false local switch = false local hot = false local cold = false local onoff = false local width, height = term.getSize() --size of the screen local function clearScreen() term.clear() --Clear the screen --Print the program and company names term.setCursorPos(1, 1) term.write("Nuclear Reactor Control Unit") term.setCursorPos(width-#companyName+1, height) term.write(companyName) end local function update() local hot = rs.testBundledInput(cableSide, heatmax) local cold = rs.testBundledInput(cableSide, heatmin) local onoff = rs.testBundledInput(cableSide, switch) end local function doTick() update() clearScreen() term.setCursorPos(1, 3) term.write("Current status: ") if onoff then if hot then term.write("Maximum heat!") rs.setBundledOutput(cableSide, danger) else term.write("Online") rs.setBundledOutput(cableSide, poweron) end else term.write("Offline") end sleep(1) end while true do doTick() end
These Lines generates the Error. But the first Code has these lines also.
local hot = rs.testBundledInput(cableSide, heatmax) local cold = rs.testBundledInput(cableSide, heatmin) local onoff = rs.testBundledInput(cableSide, switch)
What is the Solution of this Problem?