coroutinelib¶
close¶
Closes coroutine co
, closing all its pending to-be-closed variables and putting the coroutine in a dead state.
create¶
Creates a new coroutine, with body f
. f
must be a function. Returns this new coroutine, an object with type "thread"
.
isyieldable¶
Returns true when the coroutine co
can yield. The default for co
is the running coroutine.
resume¶
Starts or continues the execution of coroutine co
.
running¶
Returns the running coroutine plus a boolean, true when the running coroutine is the main one.
status¶
Returns the status of coroutine co
.
return #1:
| "running" -- Is running.
| "suspended" -- Is suspended or not started.
| "normal" -- Is active but not running.
| "dead" -- Has finished or stopped with an error.
wrap¶
Creates a new coroutine, with body f
; f
must be a function. Returns a function that resumes the coroutine each time it is called.
yield¶
Suspends the execution of the calling coroutine.