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 -
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 TypeMethodDescriptionCheck that this is aLuaUserdata, or throwLuaErrorif it is notCheck that this is aLuaUserdata, or throwLuaErrorif it is notEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ.booleanEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ, and return java booleanbooleanbooleanGet a value in a table including metatag processing usingLuaValue.INDEX.Get the metatable for thisLuaValueinthashCode()booleanCheck ifthisis auserdatabooleanisuserdata(Class c) Check ifthisis auserdataof typecoptuserdata(Class c, Object defval) Check that optional argument is a userdata whose instance is of a type and return the Object instanceoptuserdata(Object defval) Check that optional argument is a userdata and return the Object instancebooleanraweq(LuaUserdata val) Equals: Perform direct equality comparison with aLuaUserdatavalue without metatag processing.booleanEquals: Perform direct equality comparison with another value without metatag processing.voidread(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) voidSet a value in a table without metatag processing usingLuaValue.NEWINDEX.setmetatable(LuaValue metatable) Set the metatable for thisLuaValueConvert to human readable String for any type.Convert to userdata instance, or null.touserdata(Class c) Convert to userdata instance if specific type, or null.inttype()Get the enumeration value for the type of this value.typename()Get the String name of the type of this value.userdata()voidwrite(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, cachedDouble, cachedInt, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, call, call, call, call, call, checkboolean, checkclosure, checkdouble, checkfunction, checkglobals, checkint, checkinteger, checkjstring, checklong, checknotnil, checknumber, checknumber, checkstring, checktable, checkthread, comparemt, concat, concat, concatmt, concatTo, concatTo, concatTo, 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, invoke, invoke, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, isboolean, isclosure, isfunction, isint, isinttype, islong, isnil, isnumber, 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, 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, optinteger, 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, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOfMethods inherited from class com.prineside.luaj.Varargs
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkinteger, 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, optinteger, 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:
writein interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
readin interfacecom.esotericsoftware.kryo.KryoSerializable
-
tojstring
Description copied from class:LuaValueConvert to human readable String for any type. -
type
public int type()Description copied from class:LuaValueGet the enumeration value for the type of this value.- Specified by:
typein 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:LuaValueGet the String name of the type of this value.- Specified by:
typenamein classLuaValue- Returns:
- name from type name list
LuaValue.TYPE_NAMEScorresponding to the type of this value: "nil", "boolean", "number", "string", "table", "function", "userdata", "thread" - See Also:
-
hashCode
public int hashCode() -
userdata
-
isuserdata
public boolean isuserdata()Description copied from class:LuaValueCheck ifthisis auserdata- Overrides:
isuserdatain classLuaValue- Returns:
- true if this is a
userdata, otherwise false - See Also:
-
isuserdata
Description copied from class:LuaValueCheck ifthisis auserdataof typec- Overrides:
isuserdatain classLuaValue- Parameters:
c- Class to test instance against- Returns:
- true if this is a
userdataand the instance is assignable toc, otherwise false - See Also:
-
touserdata
Description copied from class:LuaValueConvert to userdata instance, or null.- Overrides:
touserdatain classLuaValue- Returns:
- userdata instance if userdata, or null if not
LuaUserdata - See Also:
-
touserdata
Description copied from class:LuaValueConvert to userdata instance if specific type, or null.- Overrides:
touserdatain classLuaValue- Returns:
- userdata instance if is a userdata whose instance derives from
c, or null if notLuaUserdata - See Also:
-
optuserdata
Description copied from class:LuaValueCheck that optional argument is a userdata and return the Object instance- Overrides:
optuserdatain classLuaValue- Parameters:
defval- Object to return ifthisis nil or none- Returns:
- Object instance of the userdata if a
LuaUserdata,defvalif nil or none, throwsLuaErrorif some other type - See Also:
-
optuserdata
Description copied from class:LuaValueCheck that optional argument is a userdata whose instance is of a type and return the Object instance- Overrides:
optuserdatain classLuaValue- Parameters:
c- Class to test userdata instance againstdefval- Object to return ifthisis nil or none- Returns:
- Object instance of the userdata if a
LuaUserdataand instance is assignable toc,defvalif nil or none, throwsLuaErrorif some other type - See Also:
-
getmetatable
Description copied from class:LuaValueGet the metatable for thisLuaValueFor
LuaTableandLuaUserdatainstances, the metatable returned is this instance metatable. For all other types, the class metatable value will be returned.- Overrides:
getmetatablein classLuaValue- Returns:
- metatable, or null if it there is none
- See Also:
-
setmetatable
Description copied from class:LuaValueSet the metatable for thisLuaValueFor
LuaTableandLuaUserdatainstances, the metatable is per instance. For all other types, there is one metatable per type that can be set directly from java- Overrides:
setmetatablein classLuaValue- Parameters:
metatable-LuaValueinstance to serve as the metatable, or null to reset it.- Returns:
thisto allow chaining of Java function calls- See Also:
-
checkuserdata
Description copied from class:LuaValueCheck that this is aLuaUserdata, or throwLuaErrorif it is not- Overrides:
checkuserdatain classLuaValue- Returns:
thisif it is aLuaUserdata- See Also:
-
checkuserdata
Description copied from class:LuaValueCheck that this is aLuaUserdata, or throwLuaErrorif it is not- Overrides:
checkuserdatain classLuaValue- Returns:
thisif it is aLuaUserdata- See Also:
-
get
Description copied from class:LuaValueGet a value in a table including metatag processing usingLuaValue.INDEX.- Overrides:
getin classLuaValue- Parameters:
key- the key to look up, must not beLuaValue.NILor null- Returns:
LuaValuefor that key, orLuaValue.NILif not found and no metatag- See Also:
-
set
Description copied from class:LuaValueSet a value in a table without metatag processing usingLuaValue.NEWINDEX.- Overrides:
setin classLuaValue- Parameters:
key- the key to use, must not beLuaValue.NILor nullvalue- the value to use, can beLuaValue.NIL, must not be null
-
equals
-
eq
Description copied from class:LuaValueEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ.- Overrides:
eqin classLuaValue- Parameters:
val- The value to compare with.- Returns:
LuaValue.TRUEif values are comparable and(this == rhs),LuaValue.FALSEif comparable but not equal,LuaValueif metatag processing occurs.- See Also:
-
eq_b
Description copied from class:LuaValueEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ, and return java boolean -
raweq
Description copied from class:LuaValueEquals: Perform direct equality comparison with another value without metatag processing. -
raweq
Description copied from class:LuaValueEquals: Perform direct equality comparison with aLuaUserdatavalue without metatag processing.- Overrides:
raweqin classLuaValue- Parameters:
val- TheLuaUserdatato compare with.- Returns:
- true if
thisis userdata and their metatables are the same using == and their instances are equal usingLuaValue.equals(Object), otherwise false - See Also:
-
eqmt
-