Modifier and Type | Method and Description |
---|---|
void |
convertJavaObject(LuaState luaState,
Object object)
Converts a Java object to a Lua value and pushes that value on the stack.
|
<T> T |
convertLuaValue(LuaState luaState,
int index,
Class<T> formalType)
Converts a Lua value to a Java object of the specified formal type.
|
static DefaultConverter |
getInstance()
Returns the instance of this class.
|
int |
getTypeDistance(LuaState luaState,
int index,
Class<?> formalType)
Returns the type distance between a Lua value and a formal Java type.
|
public static DefaultConverter getInstance()
public int getTypeDistance(LuaState luaState, int index, Class<?> formalType)
Converter
Integer.MAX_VALUE
.getTypeDistance
in interface Converter
luaState
- the Lua stateindex
- the stack index containing the valueformalType
- the formal Java typeInteger.MAX_VALUE
if the
conversion is not supportedpublic <T> T convertLuaValue(LuaState luaState, int index, Class<T> formalType)
Converter
If the Lua value is nil
, the method returns
null
.
convertLuaValue
in interface Converter
luaState
- the Lua stateindex
- the stack index containing the valueformalType
- the formal Java typenull
public void convertJavaObject(LuaState luaState, Object object)
Converter
If the object is null
, the method pushes nil
.
convertJavaObject
in interface Converter
luaState
- the Lua stateobject
- the Java object, or null