|
||||||||||
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.LuaBoolean
public final class LuaBoolean
Extension of LuaValue
which can hold a Java boolean as its value.
These instance are not instantiated directly by clients.
Instead, there are exactly twon instances of this class,
LuaValue.TRUE
and LuaValue.FALSE
representing the lua values true
and false
.
The function LuaValue.valueOf(boolean)
will always
return one of these two values.
Any LuaValue
can be converted to its equivalent
boolean representation using LuaValue.toboolean()
LuaValue
,
LuaValue.valueOf(boolean)
,
LuaValue.TRUE
,
LuaValue.FALSE
Field Summary | |
---|---|
static LuaValue |
s_metatable
Shared static metatable for boolean values represented in lua. |
boolean |
v
The value of the boolean |
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 |
Method Summary | |
---|---|
boolean |
booleanValue()
Return the boolean value for this boolean |
boolean |
checkboolean()
Check that the value is a LuaBoolean ,
or throw LuaError if not |
LuaValue |
getmetatable()
Get the metatable for this LuaValue |
boolean |
isboolean()
Check if this is a boolean |
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 |
boolean |
toboolean()
Convert to boolean false if LuaValue.NIL or FALSE , true if anything else |
java.lang.String |
tojstring()
Convert to human readable String for any type. |
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. |
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, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static LuaValue s_metatable
public final boolean v
Method Detail |
---|
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 boolean isboolean()
LuaValue
this
is a boolean
isboolean
in class LuaValue
boolean
, otherwise falseLuaValue.isboolean()
,
LuaValue.toboolean()
,
LuaValue.checkboolean()
,
LuaValue.optboolean(boolean)
,
#TOBOLEAN
public LuaValue not()
LuaValue
(~this)
as defined by lua not operator
not
in class LuaValue
TRUE
if NIL
or FALSE
, otherwise FALSE
public boolean booleanValue()
public boolean toboolean()
LuaValue
LuaValue.NIL
or FALSE
, true if anything else
toboolean
in class LuaValue
LuaValue.optboolean(boolean)
,
LuaValue.checkboolean()
,
LuaValue.isboolean()
,
TBOOLEAN
public java.lang.String tojstring()
LuaValue
tojstring
in class LuaValue
LuaValue.tostring()
,
LuaValue.optjstring(String)
,
LuaValue.checkjstring()
,
LuaValue.isstring()
,
TSTRING
public boolean optboolean(boolean defval)
LuaValue
optboolean
in class LuaValue
defval
- boolean value to return if this
is nil or none
this
cast to boolean if a ,
defval
if nil or none,
throws LuaError
otherwiseLuaValue.checkboolean()
,
LuaValue.isboolean()
,
LuaValue.TBOOLEAN
public boolean checkboolean()
LuaValue
LuaBoolean
,
or throw LuaError
if not
checkboolean
in class LuaValue
this
if it is a LuaBoolean
LuaValue.optboolean(boolean)
,
LuaValue.TBOOLEAN
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
s_metatable
,
LuaNumber.s_metatable
,
LuaNil.s_metatable
,
LuaFunction.s_metatable
,
LuaThread.s_metatable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |