Package com.prineside.luaj.lib.jse
Class CoerceLuaToJava
java.lang.Object
com.prineside.luaj.lib.jse.CoerceLuaToJava
Helper class to coerce values from lua to Java within the luajava library.
This class is primarily used by the org.luaj.vm2.lib.jse.LuajavaLib, but can also be used directly when working with Java/lua bindings.
To coerce to specific Java values, generally the toType()
methods
on LuaValue
may be used:
LuaValue.toboolean()
LuaValue.tobyte()
LuaValue.tochar()
LuaValue.toshort()
LuaValue.toint()
LuaValue.tofloat()
LuaValue.todouble()
LuaValue.tojstring()
LuaValue.touserdata()
LuaValue.touserdata(Class)
For data in lua tables, the various methods on LuaTable
can be used directly
to convert data to something more useful.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CoerceLuaToJava
public CoerceLuaToJava()
-
-
Method Details
-
coerce
Coerce a LuaValue value to a specified java class- Parameters:
value
- LuaValue to coerceclazz
- Class to coerce into- Returns:
- Object of type clazz (or a subclass) with the corresponding value.
-