public interface CoronaRuntimeTask
CoronaRuntime,
just before it renders a frame. The task will be executed on the same thread that the
CoronaRuntime runs in.
The purpose of this class is to allow another thread to send a task to the CoronaRuntime
that will manipulate its LuaState, such as calling a Lua function, on the same thread that
the CoronaRuntime and Lua is running on. This is important because you should never manipulate
the LuaState on another thread since it could cause race conditions to occur and exceptions
to be thrown, which could crash the application.
Instances of this interface are to be given to a
CoronaRuntimeTaskDispatcher object's send()
method. That class will send tasks to the CoronaRuntime in a thread safe manner.
WARNING! This task will not be executed by the CoronaRuntime on the main UI thread.
The CoronaRuntime and its Lua scripts run on a separate thread.
This means that you should never manipulate an
activity's UI elements from this class' method.
CoronaRuntime,
CoronaRuntimeTaskDispatcher| Modifier and Type | Method and Description |
|---|---|
void |
executeUsing(CoronaRuntime runtime)
Called by the
CoronaRuntime just before it renders a frame. |
void executeUsing(CoronaRuntime runtime)
CoronaRuntime just before it renders a frame.
This is the application's opportunity to call a Lua function or update global variables in Lua.
WARNING! This method is not called on the main UI thread.
runtime - Reference to the CoronaRuntime object that is currently running.
Provides access to its LuaState object.