| Lua coroutine functions |
|---|
| Lua coroutine functions These are the functions in the "coroutine" table. Coroutines are a very powerful way of splitting execution of a function up until some event occurs (for example, a timer fires, or input arrives). The function chooses when to "yield" execution. The yield / resume sequence allows variables to be passed back and forward between the thread and the caller. For example the thread can yield with an argument which tells the caller why it yielded, and the caller can resume with an argument telling the thread why it was resumed. Personally I wouldn't use coroutine.wrap, but stick to something like this:
See Also ... Topics
Lua base functions
Lua bc (big number) functions
Lua bit manipulation functions
Lua debug functions
Lua io functions
Lua math functions
Lua os functions
Lua package functions
Lua PCRE regular expression functions
Lua script extensions
Lua string functions
Lua table functions
Lua utilities
ScriptingLua functions
coroutine.create (Creates a new coroutine thread)
coroutine.resume (Start or resume a thread)
coroutine.running (Returns the running coroutine)
coroutine.status (Returns the status of a thread)
coroutine.wrap (Creates a thread and returns a function to resume it)
coroutine.yield (Yields execution of thread back to the caller)(Help topic: general=lua_coroutines)
Documentation contents page |