Lua coroutine functions |
---|
Lua coroutine functions Create a new thread using coroutine.create. At this stage it is not yet running. Commence executing the function in the thread with coroutine.resume, passing any initial arguments required. The thread yields execution, if necessary, using coroutine.yield, passing arguments back to be returned by coroutine.resume. These arguments could indicate the reason for yielding. The main script resumes the thread when it is ready to do so, calling coroutine.resume again. This time arguments passed to coroutine.resume are returned as results from the coroutine.yield call. These arguments could indicate the reason the thread is resuming (eg. data received, timeout and so on). The previous 2 steps are repeated until it is time for the function to return, effectively terminating the thread. Lua functions
coroutine.create - Creates a new coroutine thread
Topics
Lua base functions
(Help topic: general=lua_coroutines) |
Enter a search string to find matching documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.