turtle: fix pausing

This commit is contained in:
cron 2020-11-08 23:17:07 +00:00
parent 5f5dcf7195
commit 78c5bc868d
2 changed files with 4 additions and 4 deletions

View File

@ -327,7 +327,7 @@ function turtle.pause_symbolic(name)
local dead = turtle.get_symbolic(name)
for i, v in ipairs(dead) do
turtle.states[v].paused = true
turtle.states[v].state.paused = true
end
end
@ -335,7 +335,7 @@ function turtle.resume_symbolic(name)
local dead = turtle.get_symbolic(name)
for i, v in ipairs(dead) do
turtle.states[v].paused = nil
turtle.states[v].state.paused = nil
end
end

View File

@ -467,7 +467,7 @@ tlang.builtins["forever"] = function(state)
end
if state.locals[slen].loop_code == nil then
local tos = statepop(state)
local tos = tlang.pop_raw(state)
if tos.type == "code" then
state.locals[slen].loop_code = tos
@ -646,7 +646,7 @@ end
-- false - finished
-- string - error
function tlang.step(state)
if state.paused or state.wait_target and os.clock() < state.wait_target then
if state.paused or (state.wait_target and os.clock() < state.wait_target) then
return nil
end