Coroutine (type)

From ComputerCraft Wiki
Jump to: navigation, search

This is for the coroutine type, displayed as thread in the Lua language. For the API, visit Coroutine (API).

A coroutine, or thread, is an object which contains an execution context in a Lua program. A coroutine wraps up the location of the next statement to execute, the complete call stack of functions called to reach that statement, the local variables in those functions, and any other data needed to freeze, and subsequently thaw and resume, a running code sequence, as though nothing happened.

For details on how coroutines are used, see the coroutine API.