18 lines
487 B
Plaintext
18 lines
487 B
Plaintext
-- Animate 'f' by smearing its work across multiple frames.
|
|
-- Pause animation in the current frame using end_frame().
|
|
animate = function(f, ...)
|
|
local args = {...}
|
|
Error_with_callstack = nil
|
|
local co = coroutine.create(
|
|
function()
|
|
xpcall(function()
|
|
f(unpack(args))
|
|
end,
|
|
save_callstack)
|
|
end)
|
|
coroutine.resume(co, ...)
|
|
if Error_with_callstack then
|
|
error(Error_with_callstack)
|
|
end
|
|
table.insert(Animations_in_progress, {co=co})
|
|
end |