Package com.prineside.luaj
Class LuaBoolean
java.lang.Object
com.prineside.luaj.Varargs
com.prineside.luaj.LuaValue
com.prineside.luaj.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()
-
Nested Class Summary
Nested ClassesNested 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
FieldsModifier and TypeFieldDescriptionstatic LuaValue
Shared static metatable for boolean values represented in lua.boolean
The value of the booleanFields 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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the boolean value for this booleanboolean
Check that the value is aLuaBoolean
, or throwLuaError
if notGet the metatable for thisLuaValue
boolean
Check ifthis
is aboolean
not()
Unary not: return inverse boolean value(~this)
as defined by lua not operatorboolean
optboolean
(boolean defval) Check that optional argument is a boolean and return its boolean valueboolean
Convert to boolean false ifLuaValue.NIL
orLuaValue.FALSE
, true if anything elseConvert to human readable String for any type.int
type()
Get the enumeration value for the type of this value.typename()
Get the String name of the type of this value.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, checkclosure, checkdouble, checkfunction, checkglobals, checkint, checkjstring, checklong, checknotnil, checknumber, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, 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, eq, eq_b, eqmtcall, equals, error, get, 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, isclosure, isfunction, isint, isinttype, islong, isnil, isnumber, isRegObject, isstring, istable, isthread, isuserdata, isuserdata, 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, onInvoke, optclosure, optdouble, optfunction, optint, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, 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, setmetatable, 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, toString, touserdata, touserdata, 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
-
s_metatable
Shared static metatable for boolean values represented in lua. -
v
public boolean vThe value of the boolean
-
-
Method Details
-
type
public 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:
-
isboolean
public boolean isboolean()Description copied from class:LuaValue
Check ifthis
is aboolean
-
not
Description copied from class:LuaValue
Unary not: return inverse boolean value(~this)
as defined by lua not operator- Overrides:
not
in classLuaValue
- Returns:
LuaValue.TRUE
ifLuaValue.NIL
orLuaValue.FALSE
, otherwiseLuaValue.FALSE
-
booleanValue
public boolean booleanValue()Return the boolean value for this boolean- Returns:
- value as a Java boolean
-
toboolean
public boolean toboolean()Description copied from class:LuaValue
Convert to boolean false ifLuaValue.NIL
orLuaValue.FALSE
, true if anything else -
tojstring
Description copied from class:LuaValue
Convert to human readable String for any type. -
optboolean
public boolean optboolean(boolean defval) Description copied from class:LuaValue
Check that optional argument is a boolean and return its boolean value- Overrides:
optboolean
in classLuaValue
- Parameters:
defval
- boolean value to return ifthis
is nil or none- Returns:
this
cast to boolean if aLuaBoolean
,defval
if nil or none, throwsLuaError
otherwise- See Also:
-
checkboolean
public boolean checkboolean()Description copied from class:LuaValue
Check that the value is aLuaBoolean
, or throwLuaError
if not- Overrides:
checkboolean
in classLuaValue
- Returns:
- boolean value for
this
if it is aLuaBoolean
- 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
-