Atom

task.resume()

Runs a coroutine to its next suspension or return.

Signature

task.resume(handle)

Parameters

A ready or suspended coroutine owned by the VM.

Returns

Yielded or returned value, possibly null.

Behavior

Updates the coroutine state. Run in the owning VM.

Errors

Wrong type/state or error from the coroutine.

Example

Atom
use task
func sample():
    yield 4
    return 9
c = create(coroutine, sample)
assert(task.resume(c) == 4 and task.resume(c) == 9)