3
0
mirror of https://github.com/britzl/monarch.git synced 2025-06-27 10:27:49 +02:00

Assert on coroutine.resume to catch more errors

This commit is contained in:
Björn Ritzl 2019-05-02 09:36:52 +02:00
parent 9afd77e2b0
commit e4ca53630e

View File

@ -72,7 +72,7 @@ local function cowait(delay)
local co = coroutine.running() local co = coroutine.running()
assert(co, "You must run this form within a coroutine") assert(co, "You must run this form within a coroutine")
timer.delay(delay, false, function() timer.delay(delay, false, function()
coroutine.resume(co) assert(coroutine.resume(co))
end) end)
coroutine.yield() coroutine.yield()
end end
@ -594,7 +594,7 @@ function M.show(id, options, data, cb)
while top.popup do while top.popup do
stack[#stack] = nil stack[#stack] = nil
show_out(top, screen, function() show_out(top, screen, function()
coroutine.resume(co) assert(coroutine.resume(co))
end) end)
coroutine.yield() coroutine.yield()
top = stack[#stack] top = stack[#stack]
@ -624,7 +624,7 @@ function M.show(id, options, data, cb)
-- screen that has Preload set to true -- screen that has Preload set to true
if M.is_preloading(id) then if M.is_preloading(id) then
M.when_preloaded(id, function() M.when_preloaded(id, function()
coroutine.resume(co) assert(coroutine.resume(co))
end) end)
coroutine.yield() coroutine.yield()
end end
@ -632,7 +632,7 @@ function M.show(id, options, data, cb)
if cb then callbacks.when_done(cb) end if cb then callbacks.when_done(cb) end
end) end)
coroutine.resume(co) assert(coroutine.resume(co))
return true return true
end end