no goto in computercraft lua...

This commit is contained in:
LordMZTE 2021-11-13 15:25:13 +01:00
parent 7f3431b912
commit df0f056360
1 changed files with 8 additions and 11 deletions

View File

@ -8,18 +8,15 @@ 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
if type(cap) == "number" then
local newstate = reac.getEnergyStored() < cap * 0.8
local active = reac.getActive()
if newstate ~= active then
reac.setActive(newstate)
end
end
local newstate = reac.getEnergyStored() < cap * 0.8
local active = reac.getActive()
if newstate ~= active then
reac.setActive(newstate)
end
::endloop::
sleep(5)
end