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 StringConstant String representation for NaN (not a number), "nan"static final StringConstant String representation for negative infinity, "-inf"static final StringConstant String representation for positive infinity, "inf"static final LuaDoubleConstant LuaDouble representing NaN (not a number)static final LuaDoubleConstant LuaDouble representing negative infinitystatic final LuaDoubleConstant LuaDouble representing positive infinityFields inherited from class com.prineside.luaj.LuaNumber
s_metatableFields 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.doubleCheck that the value is numeric and return the value as a double, or throwLuaErrorif not numericintcheckint()Check that the value is numeric, and convert and cast value to int, or throwLuaErrorif not numericCheck that the value is numeric, and convert and cast value to int, or throwLuaErrorif not numericConvert this value to a Java String.longCheck that the value is numeric, and convert and cast value to long, or throwLuaErrorif not numericCheck that the value is numeric, and return as a LuaNumber if so, or throwLuaErrorCheck that this is a lua string, or throwLuaErrorif it is not.static LuaValueddiv(double lhs, double rhs) Divide two double numbers according to lua math, and return aLuaValueresult.static doubleddiv_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 LuaValuedmod(double lhs, double rhs) Take modulo double numbers according to lua math, and return aLuaValueresult.static doubledmod_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.booleanEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ, and return java booleanbooleangt(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.booleangt_b(double rhs) Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.booleangt_b(int rhs) Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.booleanGreater 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.booleangteq_b(double rhs) Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.booleangteq_b(int rhs) Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.booleanGreater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.inthashCode()booleanislong()Check ifthisis anumberand is representable by java long without rounding or truncationbooleanisnumber()Check ifthisis anumberbooleanisstring()Check ifthisis astringbooleanReturn 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.booleanlt_b(double rhs) Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean.booleanlt_b(int rhs) Less than: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.booleanLess 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.booleanlteq_b(double rhs) Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning java boolean.booleanlteq_b(int rhs) Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning java boolean.booleanLess 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 operatordoubleoptdouble(double defval) Check that optional argument is a number or string convertible to number and return as doubleintoptint(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 asLuaIntegeroptjstring(String defval) Check that optional argument is a string or number and return as Java Stringlongoptlong(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 asLuaNumberCheck that optional argument is a string or number and return asLuaStringpow(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 processingbooleanraweq(double val) Equals: Perform direct equality comparison with a double value without metatag processing.booleanraweq(int val) Equals: Perform direct equality comparison with a int value without metatag processing.booleanEquals: Perform direct equality comparison with another value without metatag processing.voidread(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) voidsetDirectly(double v) intPerform string comparison with another value known to be aLuaStringusing 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 processingbytetobyte()Convert to byte if numeric, or 0 if not.chartochar()Convert to char if numeric, or 0 if not.doubletodouble()Convert to double if numeric, or 0 if not.floattofloat()Convert to float if numeric, or 0 if not.inttoint()Convert to int if numeric, or 0 if not.Convert to human readable String for any type.longtolong()Convert to long if numeric, or 0 if not.tonumber()Conditionally convert to lua number without throwing errors.shorttoshort()Convert to short if numeric, or 0 if not.tostring()Conditionally convert to lua string without throwing errors.static LuaNumbervalueOf(double d) voidwrite(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, typenameMethods 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, varargsOfMethods 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:
writein interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
readin interfacecom.esotericsoftware.kryo.KryoSerializable
-
valueOf
-
setDirectly
public void setDirectly(double v) -
hashCode
public int hashCode() -
islong
public boolean islong()Description copied from class:LuaValueCheck ifthisis anumberand is representable by java long without rounding or truncation -
tobyte
public byte tobyte()Description copied from class:LuaValueConvert to byte if numeric, or 0 if not. -
tochar
public char tochar()Description copied from class:LuaValueConvert to char if numeric, or 0 if not. -
todouble
public double todouble()Description copied from class:LuaValueConvert to double if numeric, or 0 if not. -
tofloat
public float tofloat()Description copied from class:LuaValueConvert to float if numeric, or 0 if not. -
toint
public int toint()Description copied from class:LuaValueConvert to int if numeric, or 0 if not. -
tolong
public long tolong()Description copied from class:LuaValueConvert to long if numeric, or 0 if not. -
toshort
public short toshort()Description copied from class:LuaValueConvert to short if numeric, or 0 if not. -
optdouble
public double optdouble(double defval) Description copied from class:LuaValueCheck 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:LuaValueCheck that optional argument is a number or string convertible to number and return as int -
optinteger
Description copied from class:LuaValueCheck that optional argument is a number or string convertible to number and return asLuaInteger- Overrides:
optintegerin classLuaValue- Parameters:
defval-LuaIntegerto return ifthisis nil or none- Returns:
thisconverted and wrapped inLuaIntegerif numeric,defvalif nil or none, throwsLuaErrorotherwise- See Also:
-
optlong
public long optlong(long defval) Description copied from class:LuaValueCheck that optional argument is a number or string convertible to number and return as long -
checkinteger
Description copied from class:LuaValueCheck that the value is numeric, and convert and cast value to int, or throwLuaErrorif not numericValues that are
LuaNumberwill be cast to int and may lose precision. Values that areLuaStringthat can be converted to a number will be converted, then cast to int, so may also lose precision.- Overrides:
checkintegerin classLuaValue- Returns:
- value cast to a int and wrapped in
LuaIntegerif numeric - See Also:
-
neg
Description copied from class:LuaValueUnary minus: return negative value(-this)as defined by lua unary minus operator- Overrides:
negin classLuaValue- Returns:
- boolean inverse as
LuaBooleanif boolean or nil, numeric inverse asLuaNumberif numeric, or metatag processing result ifLuaValue.UNMmetatag is defined
-
equals
-
eq
Description copied from class:LuaValueEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ.- Overrides:
eqin classLuaValue- Parameters:
val- The value to compare with.- Returns:
LuaValue.TRUEif values are comparable and(this == rhs),LuaValue.FALSEif comparable but not equal,LuaValueif metatag processing occurs.- See Also:
-
eq_b
Description copied from class:LuaValueEquals: Perform equality comparison with another value including metatag processing usingLuaValue.EQ, and return java boolean -
raweq
Description copied from class:LuaValueEquals: Perform direct equality comparison with another value without metatag processing. -
raweq
public boolean raweq(double val) Description copied from class:LuaValueEquals: Perform direct equality comparison with a double value without metatag processing. -
raweq
public boolean raweq(int val) Description copied from class:LuaValueEquals: Perform direct equality comparison with a int value without metatag processing. -
add
Description copied from class:LuaValue -
add
Description copied from class:LuaValueAdd: Perform numeric add operation with another value of double type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
sub
Description copied from class:LuaValue -
sub
Description copied from class:LuaValueSubtract: Perform numeric subtract operation with another value of double type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
sub
Description copied from class:LuaValueSubtract: Perform numeric subtract operation with another value of int type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
subFrom
Description copied from class:LuaValueReverse-subtract: Perform numeric subtract operation from an int value with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
mul
Description copied from class:LuaValue -
mul
Description copied from class:LuaValueMultiply: Perform numeric multiply operation with another value of double type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
mul
Description copied from class:LuaValueMultiply: Perform numeric multiply operation with another value of int type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
pow
Description copied from class:LuaValue -
pow
Description copied from class:LuaValueRaise to power: Raise this value to a power of double type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
pow
Description copied from class:LuaValueRaise to power: Raise this value to a power of int type with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
powWith
Description copied from class:LuaValueReverse-raise to power: Raise another value of double type to this power with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
powWith
Description copied from class:LuaValueReverse-raise to power: Raise another value of double type to this power with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
div
Description copied from class:LuaValue -
div
Description copied from class:LuaValueDivide: Perform numeric divide operation by another value of double type without metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a numberFor metatag processing
LuaValue.div(LuaValue)must be used -
div
Description copied from class:LuaValueDivide: Perform numeric divide operation by another value of int type without metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a numberFor metatag processing
LuaValue.div(LuaValue)must be used -
divInto
Description copied from class:LuaValueReverse-divide: Perform numeric divide operation into another value with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
mod
Description copied from class:LuaValue -
mod
Description copied from class:LuaValueModulo: Perform numeric modulo operation with another value of double type without metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a numberFor metatag processing
LuaValue.mod(LuaValue)must be used -
mod
Description copied from class:LuaValueModulo: Perform numeric modulo operation with another value of int type without metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a numberFor metatag processing
LuaValue.mod(LuaValue)must be used -
modFrom
Description copied from class:LuaValueReverse-modulo: Perform numeric modulo operation from another value with metatag processingthismust derive fromLuaNumberor derive fromLuaStringand be convertible to a number -
ddiv
Divide two double numbers according to lua math, and return aLuaValueresult.- Parameters:
lhs- Left-hand-side of the division.rhs- Right-hand-side of the division.- Returns:
LuaValuefor 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 aLuaValueresult.- Parameters:
lhs- Left-hand-side of the modulo.rhs- Right-hand-side of the modulo.- Returns:
LuaValuefor 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:LuaValueLess 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
LuaStringor both must derive fromLuaNumber.- Overrides:
ltin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this < rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lt
Description copied from class:LuaValueLess than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue.To be comparable, this must derive from
LuaNumber.- Overrides:
ltin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this < rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lt
Description copied from class:LuaValueLess than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue.To be comparable, this must derive from
LuaNumber.- Overrides:
ltin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this < rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lt_b
Description copied from class:LuaValueLess 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
LuaStringor both must derive fromLuaNumber. -
lt_b
public boolean lt_b(int rhs) Description copied from class:LuaValueLess 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:LuaValueLess 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
LuaStringor both must derive fromLuaNumber. -
lteq
Description copied from class:LuaValueLess 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
LuaStringor both must derive fromLuaNumber.- Overrides:
lteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this <= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lteq
Description copied from class:LuaValueLess 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:
lteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this <= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lteq
Description copied from class:LuaValueLess 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:
lteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this <= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
lteq_b
Description copied from class:LuaValueLess 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
LuaStringor both must derive fromLuaNumber. -
lteq_b
public boolean lteq_b(int rhs) Description copied from class:LuaValueLess 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:LuaValueLess 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:LuaValueGreater 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
LuaStringor both must derive fromLuaNumber.- Overrides:
gtin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this > rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gt
Description copied from class:LuaValueGreater than: Perform numeric comparison with another value of double type, including metatag processing, and returningLuaValue.To be comparable, this must derive from
LuaNumber.- Overrides:
gtin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this > rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gt
Description copied from class:LuaValueGreater than: Perform numeric comparison with another value of int type, including metatag processing, and returningLuaValue.To be comparable, this must derive from
LuaNumber.- Overrides:
gtin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this > rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gt_b
Description copied from class:LuaValueGreater 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
LuaStringor both must derive fromLuaNumber. -
gt_b
public boolean gt_b(int rhs) Description copied from class:LuaValueGreater 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:LuaValueGreater 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
LuaStringor both must derive fromLuaNumber. -
gteq
Description copied from class:LuaValueGreater 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
LuaStringor both must derive fromLuaNumber.- Overrides:
gteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this >= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gteq
Description copied from class:LuaValueGreater 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:
gteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this >= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gteq
Description copied from class:LuaValueGreater 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:
gteqin classLuaValue- Parameters:
rhs- The right-hand-side value to perform the comparison with- Returns:
LuaValue.TRUEif(this >= rhs),LuaValue.FALSEif not, orLuaValueif metatag processing occurs- See Also:
-
gteq_b
Description copied from class:LuaValueGreater 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
LuaStringor both must derive fromLuaNumber. -
gteq_b
public boolean gteq_b(int rhs) Description copied from class:LuaValueGreater 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:LuaValueGreater 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:LuaValueConvert to human readable String for any type. -
strvalue
Description copied from class:LuaValue -
optstring
Description copied from class:LuaValueCheck that optional argument is a string or number and return asLuaString -
tostring
Description copied from class:LuaValueConditionally convert to lua string without throwing errors.In lua all numbers are strings, so this function will return the
LuaValuethisif it is a string or number, andLuaValue.NILfor all other cases.This allows values to be tested for their "string-ness" without the penalty of throwing exceptions.
- Overrides:
tostringin classLuaValue- Returns:
thisif it is aLuaStringorLuaNumber, otherwiseLuaValue.NIL- See Also:
-
optjstring
Description copied from class:LuaValueCheck that optional argument is a string or number and return as Java String- Overrides:
optjstringin classLuaValue- Parameters:
defval-LuaStringto return ifthisis nil or none- Returns:
thisconverted to String if a string or number,defvalif nil or none, throwsLuaErrorif some other type- See Also:
-
optnumber
Description copied from class:LuaValueCheck that optional argument is a number or string convertible to number and return asLuaNumber -
isnumber
public boolean isnumber()Description copied from class:LuaValueCheck ifthisis anumber -
isstring
public boolean isstring()Description copied from class:LuaValueCheck ifthisis astring -
tonumber
Description copied from class:LuaValueConditionally convert to lua number without throwing errors.In lua all numbers are strings, but not all strings are numbers. This function will return the
LuaValuethisif it is a number or a string convertible to a number, andLuaValue.NILfor 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:
tonumberin classLuaNumber- Returns:
thisif it is aLuaNumberorLuaStringthat can be converted to a number, otherwiseLuaValue.NIL- See Also:
-
checkint
public int checkint()Description copied from class:LuaValueCheck that the value is numeric, and convert and cast value to int, or throwLuaErrorif not numericValues that are
LuaNumberwill be cast to int and may lose precision. Values that areLuaStringthat 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:LuaValueCheck that the value is numeric, and convert and cast value to long, or throwLuaErrorif not numericValues that are
LuaNumberwill be cast to long and may lose precision. Values that areLuaStringthat can be converted to a number will be converted, then cast to long, so may also lose precision. -
checknumber
Description copied from class:LuaValueCheck that the value is numeric, and return as a LuaNumber if so, or throwLuaErrorValues that are
LuaStringthat can be converted to a number will be converted and returned.- Overrides:
checknumberin classLuaNumber- Returns:
- value as a
LuaNumberif numeric - See Also:
-
checkdouble
public double checkdouble()Description copied from class:LuaValueCheck that the value is numeric and return the value as a double, or throwLuaErrorif not numericValues that are
LuaNumberand values that areLuaStringthat can be converted to a number will be converted to double.- Overrides:
checkdoublein classLuaValue- Returns:
- value cast to a double if numeric
- See Also:
-
checkjstring
Description copied from class:LuaValueConvert 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:
checkjstringin classLuaValue- Returns:
- String representation of the value
- See Also:
-
checkstring
Description copied from class:LuaValueCheck that this is a lua string, or throwLuaErrorif it is not.In lua all numbers are strings, so this will succeed for anything that derives from
LuaStringorLuaNumber. Numbers will be converted toLuaString.- Overrides:
checkstringin classLuaValue- Returns:
LuaStringrepresentation of the value if it is aLuaStringorLuaNumber- See Also:
-
isvalidkey
public boolean isvalidkey()Description copied from class:LuaValueReturn true if this is a valid key in a table index operation.- Overrides:
isvalidkeyin classLuaValue- Returns:
- true if valid as a table key, otherwise false
- See Also:
-