public class CoronaLua extends Object
LuaState
.
You should call these methods inside a CoronaRuntimeTask
to ensure that
modifications to the LuaState
happen on the Corona thread.
Modifier and Type | Field and Description |
---|---|
static int |
NOREF
Used to mark a references as invalid.
|
static int |
REFNIL
Returned when
LuaState.ref(int) is called on a nil value. |
Constructor and Description |
---|
CoronaLua() |
Modifier and Type | Method and Description |
---|---|
static void |
deleteRef(LuaState L,
int ref)
Release the Java-side reference to a Lua value, which would otherwise
prevent the Lua value from being garbage collected.
|
static void |
dispatchEvent(LuaState L,
int listenerRef,
int nresults)
Dispatches an event by invoking the listener corresponding to
listenerRef passing the value at the top of the stack as the Corona event table.
|
static void |
dispatchRuntimeEvent(LuaState L,
int nResults)
|
static boolean |
isListener(LuaState L,
int index,
String eventName)
Returns whether the function at index is a Corona
listener.
|
static void |
newEvent(LuaState L,
String eventName)
Creates a Corona event with the
name property set to eventName.
|
static int |
newRef(LuaState L,
int index)
Creates a Java-side reference to a Lua object on the Lua stack
at index.
|
static int |
normalize(LuaState L,
int index)
Returns an absolute index location on the Lua stack
for the passed index.
|
static void |
pushHashtable(LuaState L,
Hashtable<Object,Object> hashtable)
|
static void |
pushValue(LuaState L,
Object object)
|
static Hashtable<Object,Object> |
toHashtable(LuaState L,
int index)
|
static Object |
toValue(LuaState L,
int index)
Returns an
Object for the item at the specified index. |
public static final int REFNIL
LuaState.ref(int)
is called on a nil value.public static final int NOREF
Added in daily build 2013.1227.
public static int normalize(LuaState L, int index)
public static int newRef(LuaState L, int index)
public static void deleteRef(LuaState L, int ref)
L
- The LuaState
to operate on.ref
- The Java-side reference to release.public static void dispatchEvent(LuaState L, int listenerRef, int nresults) throws Exception
newEvent()
to create this
event.
This function pops the value from the top of the Lua stack!
L
- The LuaState
to operate on.listenerRef
- A reference identifier returned by
CoronaLua.newRef()
.nresults
- The number of results to be dispatched to the
event.Exception
public static boolean isListener(LuaState L, int index, String eventName)
public static Hashtable<Object,Object> toHashtable(LuaState L, int index)
Hashtable
from a
lua table at the specified index on the
lua stack.
Added in daily build 2014.2125.
public static void dispatchRuntimeEvent(LuaState L, int nResults)
Added in daily build 2014.2125.