no goto in computercraft lua...

This commit is contained in:
LordMZTE 2021-11-13 15:25:13 +01:00
parent 7f3431b912
commit df0f056360

View file

@ -8,10 +8,7 @@ while true do
local cap = reac.getEnergyCapacity()
-- this happens when the chunk loads in for some reason. gotta check to prevent crash
if type(cap) ~= "number" then
goto endloop
end
if type(cap) == "number" then
local newstate = reac.getEnergyStored() < cap * 0.8
local active = reac.getActive()
@ -19,7 +16,7 @@ while true do
if newstate ~= active then
reac.setActive(newstate)
end
end
::endloop::
sleep(5)
end