Class CoerceLuaToJava

java.lang.Object
com.prineside.luaj.lib.jse.CoerceLuaToJava

public class CoerceLuaToJava extends Object
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:

For data in lua tables, the various methods on LuaTable can be used directly to convert data to something more useful.

See Also:
  • Constructor Details

    • CoerceLuaToJava

      public CoerceLuaToJava()
  • Method Details

    • coerce

      public static Object coerce(LuaValue value, Class clazz)
      Coerce a LuaValue value to a specified java class
      Parameters:
      value - LuaValue to coerce
      clazz - Class to coerce into
      Returns:
      Object of type clazz (or a subclass) with the corresponding value.