Fork of lines.love for live programming; useful starting point for further forks
-- A debugging aid to help animate intermediate results within f.
-- Pause animation in the current frame using loiter().
-- Try to only have one such call in your program.
-- You can have multiple, but things might get confusing if one of them indirectly calls the other,
-- or more generally if a single function ever loiters sometimes under the call tree of one and sometimes under the other.
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(Debug_animations_in_progress, {co=co, next_run=Current_time+0.3})
end