|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.luaj.vm2.Varargs org.luaj.vm2.LuaValue org.luaj.vm2.LuaUserdata
public class LuaUserdata
Field Summary | |
---|---|
java.lang.Object |
m_instance
|
LuaValue |
m_metatable
|
Fields inherited from class org.luaj.vm2.LuaValue |
---|
ADD, CALL, CONCAT, DIV, EMPTYSTRING, EQ, FALSE, INDEX, LE, LEN, LT, METATABLE, MINUSONE, MOD, MODE, MUL, NEWINDEX, NIL, 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 | |
---|---|
LuaUserdata(java.lang.Object obj)
|
|
LuaUserdata(java.lang.Object obj,
LuaValue metatable)
|
Method Summary | |
---|---|
java.lang.Object |
checkuserdata()
Check that this is a LuaUserdata , or throw LuaError if it is not |
java.lang.Object |
checkuserdata(java.lang.Class c)
Check that this is a LuaUserdata , or throw LuaError if it is not |
boolean |
eq_b(LuaValue val)
Equals: Perform equality comparison with another value including metatag processing using EQ ,
and return java boolean |
LuaValue |
eq(LuaValue val)
Equals: Perform equality comparison with another value including metatag processing using EQ . |
boolean |
eqmt(LuaValue val)
|
boolean |
equals(java.lang.Object val)
|
LuaValue |
get(LuaValue key)
Get a value in a table including metatag processing using INDEX . |
LuaValue |
getmetatable()
Get the metatable for this LuaValue |
int |
hashCode()
|
boolean |
isuserdata()
Check if this is a userdata |
boolean |
isuserdata(java.lang.Class c)
Check if this is a userdata of type c |
java.lang.Object |
optuserdata(java.lang.Class c,
java.lang.Object defval)
Check that optional argument is a userdata whose instance is of a type and return the Object instance |
java.lang.Object |
optuserdata(java.lang.Object defval)
Check that optional argument is a userdata and return the Object instance |
boolean |
raweq(LuaUserdata val)
Equals: Perform direct equality comparison with a LuaUserdata value
without metatag processing. |
boolean |
raweq(LuaValue val)
Equals: Perform direct equality comparison with another value without metatag processing. |
void |
set(LuaValue key,
LuaValue value)
Set a value in a table without metatag processing using NEWINDEX . |
LuaValue |
setmetatable(LuaValue metatable)
Set the metatable for this LuaValue |
java.lang.String |
tojstring()
Convert to human readable String for any type. |
java.lang.Object |
touserdata()
Convert to userdata instance, or null. |
java.lang.Object |
touserdata(java.lang.Class c)
Convert to userdata instance if specific type, or null. |
int |
type()
Get the enumeration value for the type of this value. |
java.lang.String |
typename()
Get the String name of the type of this value. |
java.lang.Object |
userdata()
|
Methods inherited from class org.luaj.vm2.Varargs |
---|
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkinteger, checkjstring, checklong, checknotnil, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, checkvalue, 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, subargs, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tolong, toshort, touserdata, touserdata, type |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final java.lang.Object m_instance
public LuaValue m_metatable
Constructor Detail |
---|
public LuaUserdata(java.lang.Object obj)
public LuaUserdata(java.lang.Object obj, LuaValue metatable)
Method Detail |
---|
public java.lang.String tojstring()
LuaValue
tojstring
in class LuaValue
LuaValue.tostring()
,
LuaValue.optjstring(String)
,
LuaValue.checkjstring()
,
LuaValue.isstring()
,
TSTRING
public int type()
LuaValue
type
in class LuaValue
TNIL
,
TBOOLEAN
,
TNUMBER
,
TSTRING
,
TTABLE
,
TFUNCTION
,
TUSERDATA
,
TTHREAD
LuaValue.typename()
public java.lang.String typename()
LuaValue
typename
in class LuaValue
LuaValue.TYPE_NAMES
corresponding to the type of this value:
"nil", "boolean", "number", "string",
"table", "function", "userdata", "thread"LuaValue.type()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object userdata()
public boolean isuserdata()
LuaValue
this
is a userdata
isuserdata
in class LuaValue
userdata
, otherwise falseLuaValue.isuserdata(Class)
,
LuaValue.touserdata()
,
LuaValue.checkuserdata()
,
LuaValue.optuserdata(Object)
,
LuaValue.TUSERDATA
public boolean isuserdata(java.lang.Class c)
LuaValue
this
is a userdata
of type c
isuserdata
in class LuaValue
c
- Class to test instance against
userdata
and the instance is assignable to c
,
otherwise falseLuaValue.isuserdata()
,
LuaValue.touserdata(Class)
,
LuaValue.checkuserdata(Class)
,
#optuserdata(Object,Class)
,
LuaValue.TUSERDATA
public java.lang.Object touserdata()
LuaValue
touserdata
in class LuaValue
LuaUserdata
LuaValue.optuserdata(Object)
,
LuaValue.checkuserdata()
,
LuaValue.isuserdata()
,
LuaValue.TUSERDATA
public java.lang.Object touserdata(java.lang.Class c)
LuaValue
touserdata
in class LuaValue
c
,
or null if not LuaUserdata
LuaValue.optuserdata(Class,Object)
,
LuaValue.checkuserdata(Class)
,
LuaValue.isuserdata(Class)
,
LuaValue.TUSERDATA
public java.lang.Object optuserdata(java.lang.Object defval)
LuaValue
optuserdata
in class LuaValue
defval
- Object to return if this
is nil or none
LuaUserdata
,
defval
if nil or none,
throws LuaError
if some other typeLuaValue.checkuserdata()
,
LuaValue.isuserdata()
,
LuaValue.optuserdata(Class, Object)
,
LuaValue.TUSERDATA
public java.lang.Object optuserdata(java.lang.Class c, java.lang.Object defval)
LuaValue
optuserdata
in class LuaValue
c
- Class to test userdata instance againstdefval
- Object to return if this
is nil or none
LuaUserdata
and instance is assignable to c
,
defval
if nil or none,
throws LuaError
if some other typeLuaValue.checkuserdata(Class)
,
LuaValue.isuserdata(Class)
,
LuaValue.optuserdata(Object)
,
LuaValue.TUSERDATA
public LuaValue getmetatable()
LuaValue
LuaValue
For LuaTable
and LuaUserdata
instances,
the metatable returned is this instance metatable.
For all other types, the class metatable value will be returned.
getmetatable
in class LuaValue
LuaBoolean.s_metatable
,
LuaNumber.s_metatable
,
LuaNil.s_metatable
,
LuaFunction.s_metatable
,
LuaThread.s_metatable
public LuaValue setmetatable(LuaValue metatable)
LuaValue
LuaValue
For LuaTable
and LuaUserdata
instances, the metatable is per instance.
For all other types, there is one metatable per type that can be set directly from java
setmetatable
in class LuaValue
metatable
- LuaValue
instance to serve as the metatable, or null to reset it.
this
to allow chaining of Java function callsLuaBoolean.s_metatable
,
LuaNumber.s_metatable
,
LuaNil.s_metatable
,
LuaFunction.s_metatable
,
LuaThread.s_metatable
public java.lang.Object checkuserdata()
LuaValue
LuaUserdata
, or throw LuaError
if it is not
checkuserdata
in class LuaValue
this
if it is a LuaUserdata
LuaValue.isuserdata()
,
LuaValue.optuserdata(Object)
,
LuaValue.checkuserdata(Class)
,
LuaValue.TUSERDATA
public java.lang.Object checkuserdata(java.lang.Class c)
LuaValue
LuaUserdata
, or throw LuaError
if it is not
checkuserdata
in class LuaValue
this
if it is a LuaUserdata
LuaValue.isuserdata(Class)
,
LuaValue.optuserdata(Class, Object)
,
LuaValue.checkuserdata()
,
LuaValue.TUSERDATA
public LuaValue get(LuaValue key)
LuaValue
INDEX
.
get
in class LuaValue
key
- the key to look up, must not be NIL
or null
LuaValue
for that key, or NIL
if not found and no metatagLuaValue.get(int)
,
LuaValue.get(String)
,
LuaValue.rawget(LuaValue)
public void set(LuaValue key, LuaValue value)
LuaValue
NEWINDEX
.
set
in class LuaValue
key
- the key to use, must not be NIL
or nullvalue
- the value to use, can be NIL
, must not be nullpublic boolean equals(java.lang.Object val)
equals
in class LuaValue
public LuaValue eq(LuaValue val)
LuaValue
EQ
.
eq
in class LuaValue
val
- The value to compare with.
TRUE
if values are comparable and (this == rhs)
,
FALSE
if comparable but not equal,
LuaValue
if metatag processing occurs.LuaValue.eq_b(LuaValue)
,
LuaValue.raweq(LuaValue)
,
LuaValue.neq(LuaValue)
,
LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue)
,
LuaValue.EQ
public boolean eq_b(LuaValue val)
LuaValue
EQ
,
and return java boolean
eq_b
in class LuaValue
val
- The value to compare with.
(this == rhs)
,
false if comparable but not equal,
result converted to java boolean if metatag processing occurs.LuaValue.eq(LuaValue)
,
LuaValue.raweq(LuaValue)
,
LuaValue.neq_b(LuaValue)
,
LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue)
,
LuaValue.EQ
public boolean raweq(LuaValue val)
LuaValue
raweq
in class LuaValue
val
- The value to compare with.
(this == rhs)
, false otherwiseLuaValue.eq(LuaValue)
,
LuaValue.raweq(LuaUserdata)
,
LuaValue.raweq(LuaString)
,
LuaValue.raweq(double)
,
LuaValue.raweq(int)
,
LuaValue.EQ
public boolean raweq(LuaUserdata val)
LuaValue
LuaUserdata
value
without metatag processing.
raweq
in class LuaValue
val
- The LuaUserdata
to compare with.
this
is userdata
and their metatables are the same using ==
and their instances are equal using LuaValue.equals(Object)
,
otherwise falseLuaValue.eq(LuaValue)
,
LuaValue.raweq(LuaValue)
public boolean eqmt(LuaValue val)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |