Package com.prineside.luaj
Class LuaUserdata
java.lang.Object
com.prineside.luaj.Varargs
com.prineside.luaj.LuaValue
com.prineside.luaj.LuaUserdata
- All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable
- Direct Known Subclasses:
JavaInstance
-
Nested Class Summary
Nested classes/interfaces inherited from class com.prineside.luaj.LuaValue
LuaValue.NillableSerializer, LuaValue.None
Nested classes/interfaces inherited from class com.prineside.luaj.Varargs
Varargs.ArrayVarargs
-
Field Summary
FieldsFields inherited from class com.prineside.luaj.LuaValue
ADD, CALL, CONCAT, DIV, EMPTYSTRING, ENV, EQ, FALSE, INDEX, LE, LEN, LT, METATABLE, MINUSONE, MOD, MODE, MUL, NEWINDEX, NIL, NILLABLE_SERIALIZER, NILS, NONE, NOVALS, ONE, POW, SUB, TBOOLEAN, TFUNCTION, TINT, TLIGHTUSERDATA, TNIL, TNONE, TNUMBER, TOSTRING, TRUE, TSTRING, TTABLE, TTHREAD, TUSERDATA, TVALUE, TYPE_NAMES, UNM, ZERO
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal Object
Check that this is aLuaUserdata
, or throwLuaError
if it is notfinal Object
Check that this is aLuaUserdata
, or throwLuaError
if it is notfinal LuaValue
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
.final boolean
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
, and return java booleanfinal boolean
final boolean
Get a value in a table including metatag processing usingLuaValue.INDEX
.final LuaValue
Get the metatable for thisLuaValue
final int
hashCode()
final boolean
Check ifthis
is auserdata
final boolean
isuserdata
(Class c) Check ifthis
is auserdata
of typec
final Object
optuserdata
(Class c, Object defval) Check that optional argument is a userdata whose instance is of a type and return the Object instancefinal Object
optuserdata
(Object defval) Check that optional argument is a userdata and return the Object instancefinal boolean
raweq
(LuaUserdata val) Equals: Perform direct equality comparison with aLuaUserdata
value without metatag processing.final boolean
Equals: Perform direct equality comparison with another value without metatag processing.void
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) void
Set a value in a table without metatag processing usingLuaValue.NEWINDEX
.final LuaValue
setmetatable
(LuaValue metatable) Set the metatable for thisLuaValue
Convert to human readable String for any type.final Object
Convert to userdata instance, or null.final Object
touserdata
(Class c) Convert to userdata instance if specific type, or null.final int
type()
Get the enumeration value for the type of this value.final String
typename()
Get the String name of the type of this value.final Object
userdata()
void
write
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) Methods inherited from class com.prineside.luaj.LuaValue
add, add, add, and, arg, arg1, argerror, assert_, buffer, call, call, call, call, call, cBool, cDouble, cFloat, checkboolean, checkclosure, checkdouble, checkfunction, checkglobals, checkint, checkjstring, checklong, checknotnil, checknumber, checknumber, checkstring, checktable, checkthread, cInt, cNcDouble, cNcFloat, cNcInt, cObject, comparemt, concat, concat, concatmt, concatTo, concatTo, concatTo, cRegObject, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, div, div, div, divInto, eqmtcall, error, get, get, gt, gt, gt, gt_b, gt_b, gt_b, gteq, gteq, gteq, gteq_b, gteq_b, gteq_b, inext, initupvalue1, invoke, invoke, invoke, invoke, invokemethod, invokemethod, invokemethod, invokemethod, isboolean, isclosure, isfunction, isint, isinttype, islong, isnil, isnumber, isRegObject, isstring, istable, isthread, isvalidkey, len, length, listOf, listOf, load, lt, lt, lt, lt_b, lt_b, lt_b, lteq, lteq, lteq, lteq_b, lteq_b, lteq_b, markAsConst, metatag, method, method, method, method, method, method, mod, mod, mod, modFrom, mul, mul, mul, narg, neg, neq, neq_b, next, not, onInvoke, optboolean, optclosure, optdouble, optfunction, optint, optjstring, optlong, optnumber, optstring, opttable, optthread, optvalue, or, pow, pow, pow, powWith, powWith, presize, raweq, raweq, raweq, rawget, rawget, rawget, rawlen, rawset, rawset, rawset, rawset, rawset, rawset, rawset, rawsetlist, set, set, set, set, set, set, strcmp, strcmp, strongvalue, strvalue, sub, sub, sub, subargs, subFrom, subFrom, tableOf, tableOf, tableOf, tableOf, tableOf, tableOf, tailcallOf, testfor_b, toboolean, tobyte, tochar, todouble, tofloat, toint, tolong, tonumber, toshort, tostring, toString, userdataOf, userdataOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf
Methods inherited from class com.prineside.luaj.Varargs
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkjstring, checklong, checknotnil, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, checkvalue, dealias, eval, isfunction, isnil, isnoneornil, isnumber, isstring, istable, isTailcall, isthread, isuserdata, isvalue, optboolean, optclosure, optdouble, optfunction, optint, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tolong, toshort, touserdata, touserdata, type
-
Field Details
-
m_instance
-
m_metatable
-
-
Constructor Details
-
LuaUserdata
-
LuaUserdata
-
-
Method Details
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
tojstring
Description copied from class:LuaValue
Convert to human readable String for any type. -
type
public final int type()Description copied from class:LuaValue
Get the enumeration value for the type of this value.- Specified by:
type
in classLuaValue
- Returns:
- value for this type, one of
LuaValue.TNIL
,LuaValue.TBOOLEAN
,LuaValue.TNUMBER
,LuaValue.TSTRING
,LuaValue.TTABLE
,LuaValue.TFUNCTION
,LuaValue.TUSERDATA
,LuaValue.TTHREAD
- See Also:
-
typename
Description copied from class:LuaValue
Get the String name of the type of this value.- Specified by:
typename
in classLuaValue
- Returns:
- name from type name list
LuaValue.TYPE_NAMES
corresponding to the type of this value: "nil", "boolean", "number", "string", "table", "function", "userdata", "thread" - See Also:
-
hashCode
public final int hashCode() -
userdata
-
isuserdata
public final boolean isuserdata()Description copied from class:LuaValue
Check ifthis
is auserdata
- Overrides:
isuserdata
in classLuaValue
- Returns:
- true if this is a
userdata
, otherwise false - See Also:
-
isuserdata
Description copied from class:LuaValue
Check ifthis
is auserdata
of typec
- Overrides:
isuserdata
in classLuaValue
- Parameters:
c
- Class to test instance against- Returns:
- true if this is a
userdata
and the instance is assignable toc
, otherwise false - See Also:
-
touserdata
Description copied from class:LuaValue
Convert to userdata instance, or null.- Overrides:
touserdata
in classLuaValue
- Returns:
- userdata instance if userdata, or null if not
LuaUserdata
- See Also:
-
touserdata
Description copied from class:LuaValue
Convert to userdata instance if specific type, or null.- Overrides:
touserdata
in classLuaValue
- Returns:
- userdata instance if is a userdata whose instance derives from
c
, or null if notLuaUserdata
- See Also:
-
optuserdata
Description copied from class:LuaValue
Check that optional argument is a userdata and return the Object instance- Overrides:
optuserdata
in classLuaValue
- Parameters:
defval
- Object to return ifthis
is nil or none- Returns:
- Object instance of the userdata if a
LuaUserdata
,defval
if nil or none, throwsLuaError
if some other type - See Also:
-
optuserdata
Description copied from class:LuaValue
Check that optional argument is a userdata whose instance is of a type and return the Object instance- Overrides:
optuserdata
in classLuaValue
- Parameters:
c
- Class to test userdata instance againstdefval
- Object to return ifthis
is nil or none- Returns:
- Object instance of the userdata if a
LuaUserdata
and instance is assignable toc
,defval
if nil or none, throwsLuaError
if some other type - See Also:
-
getmetatable
Description copied from class:LuaValue
Get the metatable for thisLuaValue
For
LuaTable
andLuaUserdata
instances, the metatable returned is this instance metatable. For all other types, the class metatable value will be returned.- Overrides:
getmetatable
in classLuaValue
- Returns:
- metatable, or null if it there is none
-
setmetatable
Description copied from class:LuaValue
Set the metatable for thisLuaValue
For
LuaTable
andLuaUserdata
instances, the metatable is per instance. For all other types, there is one metatable per type that can be set directly from java- Overrides:
setmetatable
in classLuaValue
- Parameters:
metatable
-LuaValue
instance to serve as the metatable, or null to reset it.- Returns:
this
to allow chaining of Java function calls
-
checkuserdata
Description copied from class:LuaValue
Check that this is aLuaUserdata
, or throwLuaError
if it is not- Overrides:
checkuserdata
in classLuaValue
- Returns:
this
if it is aLuaUserdata
- See Also:
-
checkuserdata
Description copied from class:LuaValue
Check that this is aLuaUserdata
, or throwLuaError
if it is not- Overrides:
checkuserdata
in classLuaValue
- Returns:
this
if it is aLuaUserdata
- See Also:
-
get
Description copied from class:LuaValue
Get a value in a table including metatag processing usingLuaValue.INDEX
.- Overrides:
get
in classLuaValue
- Parameters:
key
- the key to look up, must not beLuaValue.NIL
or null- Returns:
LuaValue
for that key, orLuaValue.NIL
if not found and no metatag- See Also:
-
set
Description copied from class:LuaValue
Set a value in a table without metatag processing usingLuaValue.NEWINDEX
.- Overrides:
set
in classLuaValue
- Parameters:
key
- the key to use, must not beLuaValue.NIL
or nullvalue
- the value to use, can beLuaValue.NIL
, must not be null
-
equals
-
eq
Description copied from class:LuaValue
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
.- Overrides:
eq
in classLuaValue
- Parameters:
val
- The value to compare with.- Returns:
LuaValue.TRUE
if values are comparable and(this == rhs)
,LuaValue.FALSE
if comparable but not equal,LuaValue
if metatag processing occurs.- See Also:
-
eq_b
Description copied from class:LuaValue
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
, and return java boolean -
raweq
Description copied from class:LuaValue
Equals: Perform direct equality comparison with another value without metatag processing. -
raweq
Description copied from class:LuaValue
Equals: Perform direct equality comparison with aLuaUserdata
value without metatag processing.- Overrides:
raweq
in classLuaValue
- Parameters:
val
- TheLuaUserdata
to compare with.- Returns:
- true if
this
is userdata and their metatables are the same using == and their instances are equal usingLuaValue.equals(Object)
, otherwise false - See Also:
-
eqmt
-