Class LuaDouble
- All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable
LuaNumber
which can hold a Java double as its value.
These instance are not instantiated directly by clients, but indirectly
via the static functions LuaValue.valueOf(int)
or LuaValue.valueOf(double)
functions. This ensures that values which can be represented as int
are wrapped in LuaInteger
instead of LuaDouble
.
Almost all API's implemented in LuaDouble are defined and documented in LuaValue
.
However the constants NAN
, POSINF
, NEGINF
,
JSTR_NAN
, JSTR_POSINF
, and JSTR_NEGINF
may be useful
when dealing with Nan or Infinite values.
LuaDouble also defines functions for handling the unique math rules of lua devision and modulo in
-
Nested Class Summary
Nested classes/interfaces inherited from class com.prineside.luaj.LuaValue
LuaValue.NillableSerializer, LuaValue.None
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Constant String representation for NaN (not a number), "nan"static final String
Constant String representation for negative infinity, "-inf"static final String
Constant String representation for positive infinity, "inf"static final LuaDouble
Constant LuaDouble representing NaN (not a number)static final LuaDouble
Constant LuaDouble representing negative infinitystatic final LuaDouble
Constant LuaDouble representing positive infinityFields inherited from class com.prineside.luaj.LuaNumber
s_metatable
Fields 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 TypeMethodDescriptionadd
(double lhs) Add: Perform numeric add operation with another value of double type with metatag processingAdd: Perform numeric add operation with another value including metatag processing.double
Check that the value is numeric and return the value as a double, or throwLuaError
if not numericint
checkint()
Check that the value is numeric, and convert and cast value to int, or throwLuaError
if not numericCheck that the value is numeric, and convert and cast value to int, or throwLuaError
if not numericConvert this value to a Java String.long
Check that the value is numeric, and convert and cast value to long, or throwLuaError
if not numericCheck that the value is numeric, and return as a LuaNumber if so, or throwLuaError
Check that this is a lua string, or throwLuaError
if it is not.static LuaValue
ddiv
(double lhs, double rhs) Divide two double numbers according to lua math, and return aLuaValue
result.static double
ddiv_d
(double lhs, double rhs) Divide two double numbers according to lua math, and return a double result.div
(double rhs) Divide: Perform numeric divide operation by another value of double type without metatag processingdiv
(int rhs) Divide: Perform numeric divide operation by another value of int type without metatag processingDivide: Perform numeric divide operation by another value of unknown type, including metatag processing.divInto
(double lhs) Reverse-divide: Perform numeric divide operation into another value with metatag processingstatic LuaValue
dmod
(double lhs, double rhs) Take modulo double numbers according to lua math, and return aLuaValue
result.static double
dmod_d
(double lhs, double rhs) Take modulo for double numbers according to lua math, and return a double result.Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
.boolean
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
, and return java booleanboolean
gt
(double rhs) Greater than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.gt
(int rhs) Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.boolean
gt_b
(double rhs) Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.boolean
gt_b
(int rhs) Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.boolean
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.gteq
(double rhs) Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.gteq
(int rhs) Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.boolean
gteq_b
(double rhs) Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.boolean
gteq_b
(int rhs) Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.boolean
Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.int
hashCode()
boolean
islong()
Check ifthis
is anumber
and is representable by java long without rounding or truncationboolean
isnumber()
Check ifthis
is anumber
boolean
isstring()
Check ifthis
is astring
boolean
Return true if this is a valid key in a table index operation.lt
(double rhs) Less than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.lt
(int rhs) Less than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.boolean
lt_b
(double rhs) Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.boolean
lt_b
(int rhs) Less than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.boolean
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.lteq
(double rhs) Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.lteq
(int rhs) Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.boolean
lteq_b
(double rhs) Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.boolean
lteq_b
(int rhs) Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.boolean
Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.mod
(double rhs) Modulo: Perform numeric modulo operation with another value of double type without metatag processingmod
(int rhs) Modulo: Perform numeric modulo operation with another value of int type without metatag processingModulo: Perform numeric modulo operation with another value of unknown type, including metatag processing.modFrom
(double lhs) Reverse-modulo: Perform numeric modulo operation from another value with metatag processingmul
(double lhs) Multiply: Perform numeric multiply operation with another value of double type with metatag processingmul
(int lhs) Multiply: Perform numeric multiply operation with another value of int type with metatag processingMultiply: Perform numeric multiply operation with another value of unknown type, including metatag processing.neg()
Unary minus: return negative value(-this)
as defined by lua unary minus operatordouble
optdouble
(double defval) Check that optional argument is a number or string convertible to number and return as doubleint
optint
(int defval) Check that optional argument is a number or string convertible to number and return as intoptinteger
(LuaInteger defval) Check that optional argument is a number or string convertible to number and return asLuaInteger
optjstring
(String defval) Check that optional argument is a string or number and return as Java Stringlong
optlong
(long defval) Check that optional argument is a number or string convertible to number and return as longCheck that optional argument is a number or string convertible to number and return asLuaNumber
Check that optional argument is a string or number and return asLuaString
pow
(double rhs) Raise to power: Raise this value to a power of double type with metatag processingpow
(int rhs) Raise to power: Raise this value to a power of int type with metatag processingRaise to power: Raise this value to a power including metatag processing.powWith
(double lhs) Reverse-raise to power: Raise another value of double type to this power with metatag processingpowWith
(int lhs) Reverse-raise to power: Raise another value of double type to this power with metatag processingboolean
raweq
(double val) Equals: Perform direct equality comparison with a double value without metatag processing.boolean
raweq
(int val) Equals: Perform direct equality comparison with a int value without metatag processing.boolean
Equals: Perform direct equality comparison with another value without metatag processing.void
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) void
setDirectly
(double v) int
Perform string comparison with another value known to be aLuaString
using string comparison based on byte values.strvalue()
sub
(double rhs) Subtract: Perform numeric subtract operation with another value of double type with metatag processingsub
(int rhs) Subtract: Perform numeric subtract operation with another value of int type with metatag processingSubtract: Perform numeric subtract operation with another value of unknown type, including metatag processing.subFrom
(double lhs) Reverse-subtract: Perform numeric subtract operation from an int value with metatag processingbyte
tobyte()
Convert to byte if numeric, or 0 if not.char
tochar()
Convert to char if numeric, or 0 if not.double
todouble()
Convert to double if numeric, or 0 if not.float
tofloat()
Convert to float if numeric, or 0 if not.int
toint()
Convert to int if numeric, or 0 if not.Convert to human readable String for any type.long
tolong()
Convert to long if numeric, or 0 if not.tonumber()
Conditionally convert to lua number without throwing errors.short
toshort()
Convert to short if numeric, or 0 if not.tostring()
Conditionally convert to lua string without throwing errors.static LuaNumber
valueOf
(double d) void
write
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) Methods inherited from class com.prineside.luaj.LuaNumber
checknumber, concat, concat, concatTo, concatTo, getmetatable, type, typename
Methods inherited from class com.prineside.luaj.LuaValue
add, and, arg, arg1, argerror, assert_, buffer, cachedDouble, cachedInt, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, cachedVarargsOf, call, call, call, call, call, checkboolean, checkclosure, checkfunction, checkglobals, checknotnil, checktable, checkthread, checkuserdata, checkuserdata, comparemt, concatmt, concatTo, eqmtcall, error, get, get, get, inext, initupvalue1, invoke, invoke, invoke, invoke, invoke, invoke, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, invokemethod, isboolean, isclosure, isfunction, isint, isinttype, isnil, istable, isthread, isuserdata, isuserdata, len, length, listOf, listOf, load, metatag, method, method, method, method, method, method, narg, neq, neq_b, next, not, onInvoke, optboolean, optclosure, optfunction, opttable, optthread, optuserdata, optuserdata, optvalue, or, presize, raweq, raweq, rawget, rawget, rawget, rawlen, rawset, rawset, rawset, rawset, rawset, rawset, rawset, rawsetlist, set, set, set, set, set, set, set, setmetatable, strcmp, strongvalue, subargs, subFrom, tableOf, tableOf, tableOf, tableOf, tableOf, tableOf, tailcallOf, testfor_b, toboolean, toString, touserdata, touserdata, userdataOf, userdataOf, valueOf, valueOf, valueOf, valueOf, valueOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf
Methods 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
-
NAN
Constant LuaDouble representing NaN (not a number) -
POSINF
Constant LuaDouble representing positive infinity -
NEGINF
Constant LuaDouble representing negative infinity -
JSTR_NAN
Constant String representation for NaN (not a number), "nan"- See Also:
-
JSTR_POSINF
Constant String representation for positive infinity, "inf"- See Also:
-
JSTR_NEGINF
Constant String representation for negative infinity, "-inf"- See Also:
-
-
Method Details
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
valueOf
-
setDirectly
public void setDirectly(double v) -
hashCode
public int hashCode() -
islong
public boolean islong()Description copied from class:LuaValue
Check ifthis
is anumber
and is representable by java long without rounding or truncation -
tobyte
public byte tobyte()Description copied from class:LuaValue
Convert to byte if numeric, or 0 if not. -
tochar
public char tochar()Description copied from class:LuaValue
Convert to char if numeric, or 0 if not. -
todouble
public double todouble()Description copied from class:LuaValue
Convert to double if numeric, or 0 if not. -
tofloat
public float tofloat()Description copied from class:LuaValue
Convert to float if numeric, or 0 if not. -
toint
public int toint()Description copied from class:LuaValue
Convert to int if numeric, or 0 if not. -
tolong
public long tolong()Description copied from class:LuaValue
Convert to long if numeric, or 0 if not. -
toshort
public short toshort()Description copied from class:LuaValue
Convert to short if numeric, or 0 if not. -
optdouble
public double optdouble(double defval) Description copied from class:LuaValue
Check that optional argument is a number or string convertible to number and return as double -
optint
public int optint(int defval) Description copied from class:LuaValue
Check that optional argument is a number or string convertible to number and return as int -
optinteger
Description copied from class:LuaValue
Check that optional argument is a number or string convertible to number and return asLuaInteger
- Overrides:
optinteger
in classLuaValue
- Parameters:
defval
-LuaInteger
to return ifthis
is nil or none- Returns:
this
converted and wrapped inLuaInteger
if numeric,defval
if nil or none, throwsLuaError
otherwise- See Also:
-
optlong
public long optlong(long defval) Description copied from class:LuaValue
Check that optional argument is a number or string convertible to number and return as long -
checkinteger
Description copied from class:LuaValue
Check that the value is numeric, and convert and cast value to int, or throwLuaError
if not numericValues that are
LuaNumber
will be cast to int and may lose precision. Values that areLuaString
that can be converted to a number will be converted, then cast to int, so may also lose precision.- Overrides:
checkinteger
in classLuaValue
- Returns:
- value cast to a int and wrapped in
LuaInteger
if numeric - See Also:
-
neg
Description copied from class:LuaValue
Unary minus: return negative value(-this)
as defined by lua unary minus operator- Overrides:
neg
in classLuaValue
- Returns:
- boolean inverse as
LuaBoolean
if boolean or nil, numeric inverse asLuaNumber
if numeric, or metatag processing result ifLuaValue.UNM
metatag is defined
-
equals
-
eq
Description copied from class:LuaValue
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
.- Overrides:
eq
in classLuaValue
- Parameters:
val
- The value to compare with.- Returns:
LuaValue.TRUE
if values are comparable and(this == rhs)
,LuaValue.FALSE
if comparable but not equal,LuaValue
if metatag processing occurs.- See Also:
-
eq_b
Description copied from class:LuaValue
Equals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ
, and return java boolean -
raweq
Description copied from class:LuaValue
Equals: Perform direct equality comparison with another value without metatag processing. -
raweq
public boolean raweq(double val) Description copied from class:LuaValue
Equals: Perform direct equality comparison with a double value without metatag processing. -
raweq
public boolean raweq(int val) Description copied from class:LuaValue
Equals: Perform direct equality comparison with a int value without metatag processing. -
add
Description copied from class:LuaValue
-
add
Description copied from class:LuaValue
Add: Perform numeric add operation with another value of double type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
sub
Description copied from class:LuaValue
-
sub
Description copied from class:LuaValue
Subtract: Perform numeric subtract operation with another value of double type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
sub
Description copied from class:LuaValue
Subtract: Perform numeric subtract operation with another value of int type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
subFrom
Description copied from class:LuaValue
Reverse-subtract: Perform numeric subtract operation from an int value with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
mul
Description copied from class:LuaValue
-
mul
Description copied from class:LuaValue
Multiply: Perform numeric multiply operation with another value of double type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
mul
Description copied from class:LuaValue
Multiply: Perform numeric multiply operation with another value of int type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
pow
Description copied from class:LuaValue
-
pow
Description copied from class:LuaValue
Raise to power: Raise this value to a power of double type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
pow
Description copied from class:LuaValue
Raise to power: Raise this value to a power of int type with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
powWith
Description copied from class:LuaValue
Reverse-raise to power: Raise another value of double type to this power with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
powWith
Description copied from class:LuaValue
Reverse-raise to power: Raise another value of double type to this power with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
div
Description copied from class:LuaValue
-
div
Description copied from class:LuaValue
Divide: Perform numeric divide operation by another value of double type without metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a numberFor metatag processing
LuaValue.div(LuaValue)
must be used -
div
Description copied from class:LuaValue
Divide: Perform numeric divide operation by another value of int type without metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a numberFor metatag processing
LuaValue.div(LuaValue)
must be used -
divInto
Description copied from class:LuaValue
Reverse-divide: Perform numeric divide operation into another value with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
mod
Description copied from class:LuaValue
-
mod
Description copied from class:LuaValue
Modulo: Perform numeric modulo operation with another value of double type without metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a numberFor metatag processing
LuaValue.mod(LuaValue)
must be used -
mod
Description copied from class:LuaValue
Modulo: Perform numeric modulo operation with another value of int type without metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a numberFor metatag processing
LuaValue.mod(LuaValue)
must be used -
modFrom
Description copied from class:LuaValue
Reverse-modulo: Perform numeric modulo operation from another value with metatag processingthis
must derive fromLuaNumber
or derive fromLuaString
and be convertible to a number -
ddiv
Divide two double numbers according to lua math, and return aLuaValue
result.- Parameters:
lhs
- Left-hand-side of the division.rhs
- Right-hand-side of the division.- Returns:
LuaValue
for the result of the division, taking into account positive and negiative infinity, and Nan- See Also:
-
ddiv_d
public static double ddiv_d(double lhs, double rhs) Divide two double numbers according to lua math, and return a double result.- Parameters:
lhs
- Left-hand-side of the division.rhs
- Right-hand-side of the division.- Returns:
- Value of the division, taking into account positive and negative infinity, and Nan
- See Also:
-
dmod
Take modulo double numbers according to lua math, and return aLuaValue
result.- Parameters:
lhs
- Left-hand-side of the modulo.rhs
- Right-hand-side of the modulo.- Returns:
LuaValue
for the result of the modulo, using lua's rules for modulo- See Also:
-
dmod_d
public static double dmod_d(double lhs, double rhs) Take modulo for double numbers according to lua math, and return a double result.- Parameters:
lhs
- Left-hand-side of the modulo.rhs
- Right-hand-side of the modulo.- Returns:
- double value for the result of the modulo, using lua's rules for modulo
- See Also:
-
lt
Description copied from class:LuaValue
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
.- Overrides:
lt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this < rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lt
Description copied from class:LuaValue
Less than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
lt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this < rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lt
Description copied from class:LuaValue
Less than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
lt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this < rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lt_b
Description copied from class:LuaValue
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
lt_b
public boolean lt_b(int rhs) Description copied from class:LuaValue
Less than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
lt_b
public boolean lt_b(double rhs) Description copied from class:LuaValue
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
lteq
Description copied from class:LuaValue
Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
.- Overrides:
lteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this <= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lteq
Description copied from class:LuaValue
Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
lteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this <= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lteq
Description copied from class:LuaValue
Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
lteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this <= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
lteq_b
Description copied from class:LuaValue
Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
lteq_b
public boolean lteq_b(int rhs) Description copied from class:LuaValue
Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
lteq_b
public boolean lteq_b(double rhs) Description copied from class:LuaValue
Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
gt
Description copied from class:LuaValue
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
.- Overrides:
gt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this > rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gt
Description copied from class:LuaValue
Greater than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
gt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this > rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gt
Description copied from class:LuaValue
Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
gt
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this > rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gt_b
Description copied from class:LuaValue
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
gt_b
public boolean gt_b(int rhs) Description copied from class:LuaValue
Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
gt_b
public boolean gt_b(double rhs) Description copied from class:LuaValue
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
gteq
Description copied from class:LuaValue
Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returningLuaValue
.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
.- Overrides:
gteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this >= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gteq
Description copied from class:LuaValue
Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
gteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this >= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gteq
Description copied from class:LuaValue
Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue
.To be comparable, this must derive from
LuaNumber
.- Overrides:
gteq
in classLuaValue
- Parameters:
rhs
- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUE
if(this >= rhs)
,LuaValue.FALSE
if not, orLuaValue
if metatag processing occurs- See Also:
-
gteq_b
Description copied from class:LuaValue
Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.To be comparable, both operands must derive from
LuaString
or both must derive fromLuaNumber
. -
gteq_b
public boolean gteq_b(int rhs) Description copied from class:LuaValue
Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
gteq_b
public boolean gteq_b(double rhs) Description copied from class:LuaValue
Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.To be comparable, this must derive from
LuaNumber
. -
strcmp
Description copied from class:LuaValue
-
tojstring
Description copied from class:LuaValue
Convert to human readable String for any type. -
strvalue
Description copied from class:LuaValue
-
optstring
Description copied from class:LuaValue
Check that optional argument is a string or number and return asLuaString
-
tostring
Description copied from class:LuaValue
Conditionally convert to lua string without throwing errors.In lua all numbers are strings, so this function will return the
LuaValue
this
if it is a string or number, andLuaValue.NIL
for all other cases.This allows values to be tested for their "string-ness" without the penalty of throwing exceptions.
- Overrides:
tostring
in classLuaValue
- Returns:
this
if it is aLuaString
orLuaNumber
, otherwiseLuaValue.NIL
- See Also:
-
optjstring
Description copied from class:LuaValue
Check that optional argument is a string or number and return as Java String- Overrides:
optjstring
in classLuaValue
- Parameters:
defval
-LuaString
to return ifthis
is nil or none- Returns:
this
converted to String if a string or number,defval
if nil or none, throwsLuaError
if some other type- See Also:
-
optnumber
Description copied from class:LuaValue
Check that optional argument is a number or string convertible to number and return asLuaNumber
-
isnumber
public boolean isnumber()Description copied from class:LuaValue
Check ifthis
is anumber
-
isstring
public boolean isstring()Description copied from class:LuaValue
Check ifthis
is astring
-
tonumber
Description copied from class:LuaValue
Conditionally convert to lua number without throwing errors.In lua all numbers are strings, but not all strings are numbers. This function will return the
LuaValue
this
if it is a number or a string convertible to a number, andLuaValue.NIL
for all other cases.This allows values to be tested for their "numeric-ness" without the penalty of throwing exceptions, nor the cost of converting the type and creating storage for it.
- Overrides:
tonumber
in classLuaNumber
- Returns:
this
if it is aLuaNumber
orLuaString
that can be converted to a number, otherwiseLuaValue.NIL
- See Also:
-
checkint
public int checkint()Description copied from class:LuaValue
Check that the value is numeric, and convert and cast value to int, or throwLuaError
if not numericValues that are
LuaNumber
will be cast to int and may lose precision. Values that areLuaString
that can be converted to a number will be converted, then cast to int, so may also lose precision. -
checklong
public long checklong()Description copied from class:LuaValue
Check that the value is numeric, and convert and cast value to long, or throwLuaError
if not numericValues that are
LuaNumber
will be cast to long and may lose precision. Values that areLuaString
that can be converted to a number will be converted, then cast to long, so may also lose precision. -
checknumber
Description copied from class:LuaValue
Check that the value is numeric, and return as a LuaNumber if so, or throwLuaError
Values that are
LuaString
that can be converted to a number will be converted and returned.- Overrides:
checknumber
in classLuaNumber
- Returns:
- value as a
LuaNumber
if numeric - See Also:
-
checkdouble
public double checkdouble()Description copied from class:LuaValue
Check that the value is numeric and return the value as a double, or throwLuaError
if not numericValues that are
LuaNumber
and values that areLuaString
that can be converted to a number will be converted to double.- Overrides:
checkdouble
in classLuaValue
- Returns:
- value cast to a double if numeric
- See Also:
-
checkjstring
Description copied from class:LuaValue
Convert this value to a Java String.The string representations here will roughly match what is produced by the C lua distribution, however hash codes have no relationship, and there may be differences in number formatting.
- Overrides:
checkjstring
in classLuaValue
- Returns:
- String representation of the value
- See Also:
-
checkstring
Description copied from class:LuaValue
Check that this is a lua string, or throwLuaError
if it is not.In lua all numbers are strings, so this will succeed for anything that derives from
LuaString
orLuaNumber
. Numbers will be converted toLuaString
.- Overrides:
checkstring
in classLuaValue
- Returns:
LuaString
representation of the value if it is aLuaString
orLuaNumber
- See Also:
-
isvalidkey
public boolean isvalidkey()Description copied from class:LuaValue
Return true if this is a valid key in a table index operation.- Overrides:
isvalidkey
in classLuaValue
- Returns:
- true if valid as a table key, otherwise false
- See Also:
-