coroutine
Coroutines: functions that stop half way and carry on later, by hand.
coroutine.create
coroutine.create(f)A coroutine for a function: it runs only when it is resumed, and can hand values back and forth with yield.
coroutine.resume
coroutine.resume(co, ...)Carries a coroutine on (its values are what its yield gives back). Gives true and what it yields or returns, or false and an error.
coroutine.yield
coroutine.yield(...)Stops this coroutine and hands its values to whoever resumed it; it carries on from here when it is resumed again.
coroutine.wrap
coroutine.wrap(f)A function that resumes a coroutine each time it is called, and gives what it yields.
coroutine.status
coroutine.status(co)"suspended", "running", "normal" (it resumed another) or "dead".
coroutine.running
coroutine.running()The task or coroutine this code is running in.
coroutine.isyieldable
coroutine.isyieldable()Always true: any task can wait.
coroutine.close
coroutine.close(co)Ends a coroutine that is waiting.