public class LuaNil extends LuaValue
nil
There will be one instance of this class, LuaValue.NIL,
per Java virtual machine.
However, the Varargs instance LuaValue.NONE
which is the empty list,
is also considered treated as a nil value by default.
Although it is possible to test for nil using Java == operator,
the recommended approach is to use the method LuaValue.isnil()
instead. By using that any ambiguities between
LuaValue.NIL and LuaValue.NONE are avoided.
LuaValue,
LuaValue.NIL| 限定符和类型 | 字段和说明 |
|---|---|
static LuaValue |
s_metatable |
ADD, BAND, BNOT, BOR, BXOR, CALL, CONCAT, DIV, EMPTYSTRING, ENV, EQ, FALSE, IDIV, INDEX, LE, LEN, LT, METATABLE, MINUSONE, MOD, MODE, MUL, NEWINDEX, NIL, NILS, NONE, NOVALS, ONE, POW, SHL, SHR, SUB, TBOOLEAN, TFUNCTION, TINT, TLIGHTUSERDATA, TNIL, TNONE, TNUMBER, TOSTRING, TRUE, TSTRING, TTABLE, TTHREAD, TUSERDATA, TVALUE, TYPE_NAMES, UNM, uservalue, ZERO| 限定符和类型 | 方法和说明 |
|---|---|
LuaValue |
checknotnil()
Check that this is not the value
LuaValue.NIL, or throw LuaError if it is |
boolean |
equals(Object o) |
LuaValue |
getmetatable()
Get the metatable for this
LuaValue
For LuaTable and LuaUserdata instances,
the metatable returned is this instance metatable. |
boolean |
isnil()
Check if
this is #NIL |
boolean |
isvalidkey()
Return true if this is a valid key in a table index operation.
|
LuaValue |
not()
Unary not: return inverse boolean value
(~this) as defined by lua not operator |
boolean |
optboolean(boolean defval)
Check that optional argument is a boolean and return its boolean value
|
LuaClosure |
optclosure(LuaClosure defval)
Check that optional argument is a closure and return as
LuaClosure
A LuaClosure is a LuaFunction that executes lua byteccode. |
double |
optdouble(double defval)
Check that optional argument is a number or string convertible to number and return as double
|
LuaFunction |
optfunction(LuaFunction defval)
Check that optional argument is a function and return as
LuaFunction
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode. |
int |
optint(int defval)
Check that optional argument is a number or string convertible to number and return as int
|
LuaInteger |
optinteger(LuaInteger defval)
Check that optional argument is a number or string convertible to number and return as
LuaInteger |
String |
optjstring(String defval)
Check that optional argument is a string or number and return as Java String
|
long |
optlong(long defval)
Check that optional argument is a number or string convertible to number and return as long
|
LuaNumber |
optnumber(LuaNumber defval)
Check that optional argument is a number or string convertible to number and return as
LuaNumber |
LuaString |
optstring(LuaString defval)
Check that optional argument is a string or number and return as
LuaString |
LuaTable |
opttable(LuaTable defval)
Check that optional argument is a table and return as
LuaTable |
LuaThread |
optthread(LuaThread defval)
Check that optional argument is a thread and return as
LuaThread |
Object |
optuserdata(Class c,
Object defval)
Check that optional argument is a userdata whose instance is of a type
and return the Object instance
|
Object |
optuserdata(Object defval)
Check that optional argument is a userdata and return the Object instance
|
LuaValue |
optvalue(LuaValue defval)
Perform argument check that this is not nil or none.
|
boolean |
toboolean()
Convert to boolean false if
LuaValue.NIL or LuaValue.FALSE, true if anything else |
String |
tojstring()
Convert to human readable String for any type.
|
String |
toString()
Convert the value to a human readable string using
LuaValue.tojstring() |
int |
type()
Get the enumeration value for the type of this value.
|
String |
typename()
Get the String name of the type of this value.
|
add, add, add, and, arg, arg1, argerror, argerror, aritherror, aritherror, arithmt, arithmtwith, assert_, band, band, bnot, bor, bor, buffer, bxor, bxor, call, call, call, call, call, callmt, checkboolean, checkclosure, checkdouble, checkfunction, checkglobals, checkint, checkinteger, checkjstring, checklong, checkmetatag, checknumber, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, compareerror, compareerror, comparemt, concat, concat, concatmt, concatTo, concatTo, concatTo, div, div, div, divInto, eq_b, eq, eqmtcall, error, get, get, get, getfenv, gettable, getuservalue, gt_b, gt_b, gt_b, gt, gt, gt, gteq_b, gteq_b, gteq_b, gteq, gteq, gteq, idiv, idiv, illegal, inext, initupvalue1, invoke, invoke, invoke, invoke, invoke, invoke, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, isboolean, isclosure, isfunction, isint, isinttype, islong, isnumber, isstring, istable, isthread, isuserdata, isuserdata, jcall, jget, jset, len, lenerror, length, listOf, listOf, load, lt_b, lt_b, lt_b, lt, lt, lt, lteq_b, lteq_b, lteq_b, lteq, lteq, lteq, metatableOf, metatag, method, method, method, method, method, method, mod, mod, mod, modFrom, mul, mul, mul, narg, neg, neq_b, neq, next, onInvoke, or, pow, pow, pow, powWith, powWith, presize, raweq, raweq, raweq, raweq, raweq, rawget, rawget, rawget, rawlen, rawset, rawset, rawset, rawset, rawset, rawset, rawset, rawsetlist, set, set, set, set, set, set, set, setfenv, setmetatable, settable, setuservalue, shl, shl, shr, shr, strcmp, strcmp, strongvalue, strvalue, sub, sub, sub, subargs, subFrom, subFrom, tableOf, tableOf, tableOf, tableOf, tableOf, tableOf, tailcallOf, testfor_b, tobyte, tochar, todouble, tofloat, toint, tolong, tonumber, toshort, tostring, touserdata, touserdata, typerror, unimplemented, userdataOf, userdataOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOfargcheck, 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, typepublic static LuaValue s_metatable
public int type()
LuaValuetype 在类中 LuaValueLuaValue.TNIL,
LuaValue.TBOOLEAN,
LuaValue.TNUMBER,
LuaValue.TSTRING,
LuaValue.TTABLE,
LuaValue.TFUNCTION,
LuaValue.TUSERDATA,
LuaValue.TTHREADLuaValue.typename()public String toString()
LuaValueLuaValue.tojstring()toString 在类中 LuaValueLuaValue.tostring(),
LuaValue.tojstring(),
LuaValue.optstring(LuaString),
LuaValue.checkstring(),
LuaValue.toString()public String typename()
LuaValuetypename 在类中 LuaValueLuaValue.TYPE_NAMES
corresponding to the type of this value:
"nil", "boolean", "number", "string",
"table", "function", "userdata", "thread"LuaValue.type()public String tojstring()
LuaValuetojstring 在类中 LuaValueLuaValue.tostring(),
LuaValue.optjstring(String),
LuaValue.checkjstring(),
LuaValue.isstring(),
LuaValue.TSTRINGpublic LuaValue not()
LuaValue(~this) as defined by lua not operatornot 在类中 LuaValueLuaValue.TRUE if LuaValue.NIL or LuaValue.FALSE, otherwise LuaValue.FALSEpublic boolean toboolean()
LuaValueLuaValue.NIL or LuaValue.FALSE, true if anything elsetoboolean 在类中 LuaValueLuaValue.optboolean(boolean),
LuaValue.checkboolean(),
LuaValue.isboolean(),
LuaValue.TBOOLEANpublic boolean isnil()
LuaValuethis is #NILisnil 在类中 LuaValue#NIL, otherwise falseLuaValue.NIL,
LuaValue.NONE,
LuaValue.checknotnil(),
LuaValue.optvalue(LuaValue),
Varargs.isnoneornil(int),
LuaValue.TNIL,
LuaValue.TNONEpublic LuaValue getmetatable()
LuaValueLuaValue
For LuaTable and LuaUserdata instances,
the metatable returned is this instance metatable.
For all other types, the class metatable value will be returned.
getmetatable 在类中 LuaValueLuaBoolean.s_metatable,
LuaNumber.s_metatable,
s_metatable,
LuaFunction.s_metatable,
LuaThread.s_metatablepublic LuaValue checknotnil()
LuaValueLuaValue.NIL, or throw LuaError if it ischecknotnil 在类中 LuaValuethis if it is not LuaValue.NILLuaValue.optvalue(LuaValue)public boolean isvalidkey()
LuaValueisvalidkey 在类中 LuaValueLuaValue.isnil(),
LuaValue.isinttype()public boolean optboolean(boolean defval)
LuaValueoptboolean 在类中 LuaValuedefval - boolean value to return if this is nil or nonethis cast to boolean if a LuaBoolean,
defval if nil or none,
throws LuaError otherwiseLuaValue.checkboolean(),
LuaValue.isboolean(),
LuaValue.TBOOLEANpublic LuaClosure optclosure(LuaClosure defval)
LuaValueLuaClosure
A LuaClosure is a LuaFunction that executes lua byteccode.
optclosure 在类中 LuaValuedefval - LuaClosure to return if this is nil or nonethis cast to LuaClosure if a function,
defval if nil or none,
throws LuaError otherwiseLuaValue.checkclosure(),
LuaValue.isclosure(),
LuaValue.TFUNCTIONpublic double optdouble(double defval)
LuaValueoptdouble 在类中 LuaValuedefval - double to return if this is nil or nonethis cast to double if numeric,
defval if nil or none,
throws LuaError otherwiseLuaValue.optint(int),
LuaValue.optinteger(LuaInteger),
LuaValue.checkdouble(),
LuaValue.todouble(),
LuaValue.tonumber(),
LuaValue.isnumber(),
LuaValue.TNUMBERpublic LuaFunction optfunction(LuaFunction defval)
LuaValueLuaFunction
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode.
optfunction 在类中 LuaValuedefval - LuaFunction to return if this is nil or nonethis cast to LuaFunction if a function,
defval if nil or none,
throws LuaError otherwiseLuaValue.checkfunction(),
LuaValue.isfunction(),
LuaValue.TFUNCTIONpublic int optint(int defval)
LuaValueoptint 在类中 LuaValuedefval - int to return if this is nil or nonethis cast to int if numeric,
defval if nil or none,
throws LuaError otherwiseLuaValue.optdouble(double),
LuaValue.optlong(long),
LuaValue.optinteger(LuaInteger),
LuaValue.checkint(),
LuaValue.toint(),
LuaValue.tonumber(),
LuaValue.isnumber(),
LuaValue.TNUMBERpublic LuaInteger optinteger(LuaInteger defval)
LuaValueLuaIntegeroptinteger 在类中 LuaValuedefval - LuaInteger to return if this is nil or nonethis converted and wrapped in LuaInteger if numeric,
defval if nil or none,
throws LuaError otherwiseLuaValue.optdouble(double),
LuaValue.optint(int),
LuaValue.checkint(),
LuaValue.toint(),
LuaValue.tonumber(),
LuaValue.isnumber(),
LuaValue.TNUMBERpublic long optlong(long defval)
LuaValueoptlong 在类中 LuaValuedefval - long to return if this is nil or nonethis cast to long if numeric,
defval if nil or none,
throws LuaError otherwiseLuaValue.optdouble(double),
LuaValue.optint(int),
LuaValue.checkint(),
LuaValue.toint(),
LuaValue.tonumber(),
LuaValue.isnumber(),
LuaValue.TNUMBERpublic LuaNumber optnumber(LuaNumber defval)
LuaValueLuaNumberoptnumber 在类中 LuaValuedefval - LuaNumber to return if this is nil or nonethis cast to LuaNumber if numeric,
defval if nil or none,
throws LuaError otherwiseLuaValue.optdouble(double),
LuaValue.optlong(long),
LuaValue.optint(int),
LuaValue.checkint(),
LuaValue.toint(),
LuaValue.tonumber(),
LuaValue.isnumber(),
LuaValue.TNUMBERpublic LuaTable opttable(LuaTable defval)
LuaValueLuaTableopttable 在类中 LuaValuedefval - LuaTable to return if this is nil or nonethis cast to LuaTable if a table,
defval if nil or none,
throws LuaError if some other typeLuaValue.checktable(),
LuaValue.istable(),
LuaValue.TTABLEpublic LuaThread optthread(LuaThread defval)
LuaValueLuaThreadoptthread 在类中 LuaValuedefval - LuaThread to return if this is nil or nonethis cast to LuaTable if a thread,
defval if nil or none,
throws LuaError if some other typeLuaValue.checkthread(),
LuaValue.isthread(),
LuaValue.TTHREADpublic String optjstring(String defval)
LuaValueoptjstring 在类中 LuaValuedefval - LuaString to return if this is nil or nonethis converted to String if a string or number,
defval if nil or none,
throws LuaError if some other typeLuaValue.tojstring(),
LuaValue.optstring(LuaString),
LuaValue.checkjstring(),
LuaValue.toString(),
LuaValue.TSTRINGpublic LuaString optstring(LuaString defval)
LuaValueLuaStringoptstring 在类中 LuaValuedefval - LuaString to return if this is nil or nonethis converted to LuaString if a string or number,
defval if nil or none,
throws LuaError if some other typeLuaValue.tojstring(),
LuaValue.optjstring(String),
LuaValue.checkstring(),
LuaValue.toString(),
LuaValue.TSTRINGpublic Object optuserdata(Object defval)
LuaValueoptuserdata 在类中 LuaValuedefval - Object to return if this is nil or noneLuaUserdata,
defval if nil or none,
throws LuaError if some other typeLuaValue.checkuserdata(),
LuaValue.isuserdata(),
LuaValue.optuserdata(Class, Object),
LuaValue.TUSERDATApublic Object optuserdata(Class c, Object defval)
LuaValueoptuserdata 在类中 LuaValuec - Class to test userdata instance againstdefval - Object to return if this is nil or noneLuaUserdata 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.TUSERDATApublic LuaValue optvalue(LuaValue defval)
LuaValueoptvalue 在类中 LuaValuedefval - LuaValue to return if this is nil or nonethis if not nil or none, else defvalLuaValue.NIL,
LuaValue.NONE,
LuaValue.isnil(),
Varargs.isnoneornil(int),
LuaValue.TNIL,
LuaValue.TNONECopyright © 2020. All rights reserved.