Class JavaInstance

All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable
Direct Known Subclasses:
JavaClass

public class JavaInstance extends LuaUserdata
LuaValue that represents a Java instance.

Will respond to get() and set() by returning field values or methods.

This class is not used directly. It is returned by calls to CoerceJavaToLua.coerce(Object) when a subclass of Object is supplied.

See Also:
  • Constructor Details

    • JavaInstance

      public JavaInstance(Object instance)
  • Method Details

    • write

      public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output)
      Specified by:
      write in interface com.esotericsoftware.kryo.KryoSerializable
      Overrides:
      write in class LuaUserdata
    • read

      public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input)
      Specified by:
      read in interface com.esotericsoftware.kryo.KryoSerializable
      Overrides:
      read in class LuaUserdata
    • len

      public LuaValue len()
      Description copied from class: LuaValue
      Length operator: return lua length of object (#this) including metatag processing as java int
      Overrides:
      len in class LuaValue
      Returns:
      length as defined by the lua # operator or metatag processing result
    • reset

      public void reset()
    • get

      public final LuaValue get(LuaValue key)
      Description copied from class: LuaValue
      Get a value in a table including metatag processing using LuaValue.INDEX.
      Overrides:
      get in class LuaUserdata
      Parameters:
      key - the key to look up, must not be LuaValue.NIL or null
      Returns:
      LuaValue for that key, or LuaValue.NIL if not found and no metatag
      See Also:
    • set

      public final void set(LuaValue key, LuaValue value)
      Description copied from class: LuaValue
      Set a value in a table without metatag processing using LuaValue.NEWINDEX.
      Overrides:
      set in class LuaUserdata
      Parameters:
      key - the key to use, must not be LuaValue.NIL or null
      value - the value to use, can be LuaValue.NIL, must not be null