no goto in computercraft lua...
This commit is contained in:
parent
7f3431b912
commit
df0f056360
|
@ -8,18 +8,15 @@ while true do
|
||||||
local cap = reac.getEnergyCapacity()
|
local cap = reac.getEnergyCapacity()
|
||||||
|
|
||||||
-- this happens when the chunk loads in for some reason. gotta check to prevent crash
|
-- this happens when the chunk loads in for some reason. gotta check to prevent crash
|
||||||
if type(cap) ~= "number" then
|
if type(cap) == "number" then
|
||||||
goto endloop
|
local newstate = reac.getEnergyStored() < cap * 0.8
|
||||||
|
|
||||||
|
local active = reac.getActive()
|
||||||
|
|
||||||
|
if newstate ~= active then
|
||||||
|
reac.setActive(newstate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local newstate = reac.getEnergyStored() < cap * 0.8
|
|
||||||
|
|
||||||
local active = reac.getActive()
|
|
||||||
|
|
||||||
if newstate ~= active then
|
|
||||||
reac.setActive(newstate)
|
|
||||||
end
|
|
||||||
|
|
||||||
::endloop::
|
|
||||||
sleep(5)
|
sleep(5)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue