yield( )
Yields control back to the caller from within a coroutine.

A coroutine is a special kind of function that can yield control back to the caller without completely exiting. The caller can then resume the coroutine as many times as needed until the function exits.

The coroutine calls yield() to suspend the coroutine and return control back to the caller in this way. It does not accept any values. (Lua and other languages support yielding and returning values from coroutines, but PICO-8 does not.)

yield() returns all extra arguments passed to the coresume() that resumed it.

To terminate the coroutine, the function returns with the return statement. After this point, the coroutine is considered dead and cannot be resumed.

Examples Edit

See cocreate() and coresume() for examples.

See also Edit

Community content is available under CC-BY-SA unless otherwise noted.