Scaleform Studio Lua API Reference: coroutine namespace reference
Provided for independent thread of execution.
|
Creates a new coroutine with bofy f; it does not start the coroutine execution.
|
Parameters f : | fun(any*:any*) |
A Lua function that is the main function of the coroutine.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
Returns any |
Returns a handle to the new coroutine (an obbject of type thread).
|
|
resume ( co, val ) : boolean, any
Starts or continues the execution of a thread created by coroutine.create, co, .
|
Parameters co : | fun(any*:any*) |
The coroutine function to be executed.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
val : | any* |
The values passed as argument to the function.
The * notation indicates that there may be zero or more instances of the specified type. |
Returns boolean |
Returns true if the coroutine runs successfully and false for any error.
|
any |
Returns the values returned by the function if coroutine ran without errors, or an error message if coroutine failed.
|
The first time you resume a coroutine, it starts running its body.
Any values supplied after the thread are returned as results from the coroutine.yield inside the thread. If this is the first call for this thread,
the values are supplied to the function itself. If this runs successfully, returns true, followed by arguments to the coroutine.yield inside the
function (if called), or the return value of the function itself.
|
Returns the running coroutine, or nil when called by the main thread.
|
Parameters | This function does not accept any parameters. |
Returns | This function does not return any values. |
|
Returns a string indicating the status of the coroutine, co.
|
Parameters co : | fun(any*:any*) |
The coroutine function to be executed.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
Returns string |
The status of the coroutine. The returned string can be one of the following
- "running": If the coroutine is running.
- "suspended": if the coroutine is suspended in a call to yield, or if it has not started running yet.
- "normal": if the coroutine is active but not running (it has resumed another coroutine).
- "dead": if the coroutine has finished its body function, or if it has stopped with an error.
|
|
wrap ( f ) : fun(any*:any*)
Creates a new coroutine, with body f and then returns a function that can be used to resume the coroutine.
|
Parameters f : | fun(any*:any*) |
A Lua function that is called.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
Returns fun(any*:any*) |
A function that resumes the coroutine each time it is called.
The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon.. |
|
Suspends the execution of the calling coroutine.
|
Parameters values : | any* |
Arguments if any; passed to resume.
The * notation indicates that there may be zero or more instances of the specified type. |
Returns | This function does not return any values. |
The coroutine cannot be running a C function, a metamethod, or an iterator.
Any arguments to yield are passed as extra results to coroutine.resume.
coroutine.create (f) : any
Creates a new coroutine with bofy f; it does not start the coroutine execution.
f : fun(any*:any*)
A Lua function that is the main function of the coroutine.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
any
Returns a handle to the new coroutine (an obbject of type thread).This value may be an instance of any type.
coroutine.resume (co, val) : boolean, any
Starts or continues the execution of a thread created by coroutine.create, co, .
co : fun(any*:any*)
The coroutine function to be executed.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
val : any*
The values passed as argument to the function.The * notation indicates that there may be zero or more instances of the specified type.
boolean
any
Returns the values returned by the function if coroutine ran without errors, or an error message if coroutine failed.true or false.
coroutine.yield (values)
Suspends the execution of the calling coroutine.
coroutine.running ()
Returns the running coroutine, or nil when called by the main thread.
coroutine.status (co) : string
Returns a string indicating the status of the coroutine, co.
co : fun(any*:any*)
The coroutine function to be executed.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
string
The status of the coroutine. [more ...]A string of characters.
coroutine.wrap (f) : fun(any*:any*)
Creates a new coroutine, with body f and then returns a function that can be used to resume the coroutine.
f : fun(any*:any*)
A Lua function that is called.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
fun(any*:any*)
A function that resumes the coroutine each time it is called.The fun(...) notation indicates that this is a function that accepts parameters of the types shown to the left of the colon :, and that returns the types shown to the right of the colon..
values : any*
Arguments if any; passed to resume.The * notation indicates that there may be zero or more instances of the specified type.
Indicates a table.
This documentation uses the term table to mean an anonymous, temporary Lua table that contains named data values. You typically use these tables to pass data or settings to a function, or to hold data returned by a function.Indicates an object.
This documentation uses the term object to mean a named Lua table or userdata value that maintains a state. Some object types may have multiple instances existing at the same time, each with its own state; these objects typically have creation functions or accessors that you must call in order to get an instance. Some object types have only one instance, which you always access through the object's name.Indicates a named variable within a namespace, object or table; or an element within an enumeration.Indicates a code sample.Indicates an enumeration.
This documentation uses the term enumeration to mean a named Lua table that contains only a set of constant values. These values typically identify a predefined set of options for some setting or behavior. You might pass an enumeration value to a function, or test the value returned by a function against the items in the enumeration to see which option is currently set.Indicates a named variable within a namespace or object that has a pre-set constant value.Indicates a category: a semantic grouping of related API elements.Indicates a namespace.
This documentation uses the term namespace to mean a named Lua table that exists in only one single instance, intended as a container for an interface of related objects, functions and data variables.Indicates an output value returned by a function.Indicates a named function within a namespace or object.Indicates an input parameter for a function.