-- ^s function mkfunc (printfunc) return function () for v = 1, 10 do printfunc (v) coroutine.yield () end end end function printalpha (n) print (string.char (n + string.byte ("A") - 1)) end function costat (c) return coroutine.status (c) == "suspended" end local c, d = coroutine.create (mkfunc (print)), coroutine.create (mkfunc (printalpha)) while costat (c) or costat (d) do coroutine.resume (c) coroutine.resume (d) end while true do coroutine.resume (c) coroutine.resume (d) end