6.2 – Coroutine Manipulation

This library comprises the operations to manipulate coroutines, which come inside the table coroutine. See §2.6 for a general description of coroutines.

coroutine.wrap()

coroutine.wrap (f) Creates a new coroutine, with body f. f must be a function. Returns a function that resumes the coroutine each time it is called.

2017-02-21 04:10:35
coroutine.yield()

coroutine.yield (···) Suspends the execution of the calling coroutine. Any arguments to yield are passed as extra results to resume.

2017-02-21 04:10:35
coroutine.status()

coroutine.status (co) Returns the status of coroutine co, as a string: "running", if the coroutine is running (that is, it called status);

2017-02-21 04:10:34
coroutine.resume()

coroutine.resume (co [, val1, ···]) Starts or continues the execution of coroutine co. The first time you resume a coroutine, it starts running its body. The values

2017-02-21 04:10:33
coroutine.running()

coroutine.running () Returns the running coroutine plus a boolean, true when the running coroutine is the main one.

2017-02-21 04:10:33
coroutine.create()

coroutine.create (f) Creates a new coroutine, with body f. f must be a function. Returns this new coroutine, an object with type "thread"

2017-02-21 04:10:31
coroutine.isyieldable()

coroutine.isyieldable () Returns true when the running coroutine can yield. A running coroutine is yieldable if it is not the main thread and it is not inside a non-yieldable

2017-02-21 04:10:32