|
||||||||||
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.LuaNumber org.luaj.vm2.LuaDouble
public class LuaDouble
Extension of 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
LuaValue
,
LuaNumber
,
LuaInteger
,
LuaValue.valueOf(int)
,
LuaValue.valueOf(double)
Field Summary | |
---|---|
static java.lang.String |
JSTR_NAN
Constant String representation for NaN (not a number), "nan" |
static java.lang.String |
JSTR_NEGINF
Constant String representation for negative infinity, "-inf" |
static java.lang.String |
JSTR_POSINF
Constant String representation for positive infinity, "inf" |
static LuaDouble |
NAN
Constant LuaDouble representing NaN (not a number) |
static LuaDouble |
NEGINF
Constant LuaDouble representing negative infinity |
static LuaDouble |
POSINF
Constant LuaDouble representing positive infinity |
Fields inherited from class org.luaj.vm2.LuaNumber |
---|
s_metatable |
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 | |
---|---|
LuaValue |
add(double lhs)
Add: Perform numeric add operation with another value of double type with metatag processing |
LuaValue |
add(LuaValue rhs)
Add: Perform numeric add operation with another value including metatag processing. |
double |
checkdouble()
Check that the value is numeric and return the value as a double, or throw LuaError if not numeric |
int |
checkint()
Check that the value is numeric, and convert and cast value to int, or throw LuaError if not numeric |
LuaInteger |
checkinteger()
Check that the value is numeric, and convert and cast value to int, or throw LuaError if not numeric |
java.lang.String |
checkjstring()
Convert this value to a Java String. |
long |
checklong()
Check that the value is numeric, and convert and cast value to long, or throw LuaError if not numeric |
LuaNumber |
checknumber()
Check that the value is numeric, and return as a LuaNumber if so, or throw LuaError |
LuaString |
checkstring()
Check that this is a lua string, or throw LuaError if it is not. |
LuaValue |
checkvalidkey()
Check that this is a valid key in a table index operation, or throw LuaError if not |
static double |
ddiv_d(double lhs,
double rhs)
Divide two double numbers according to lua math, and return a double result. |
static LuaValue |
ddiv(double lhs,
double rhs)
Divide two double numbers according to lua math, and return a LuaValue result. |
LuaValue |
div(double rhs)
Divide: Perform numeric divide operation by another value of double type without metatag processing |
LuaValue |
div(int rhs)
Divide: Perform numeric divide operation by another value of int type without metatag processing |
LuaValue |
div(LuaValue rhs)
Divide: Perform numeric divide operation by another value of unknown type, including metatag processing. |
LuaValue |
divInto(double lhs)
Reverse-divide: Perform numeric divide operation into another value with metatag processing |
static double |
dmod_d(double lhs,
double rhs)
Take modulo for double numbers according to lua math, and return a double result. |
static LuaValue |
dmod(double lhs,
double rhs)
Take modulo double numbers according to lua math, and return a LuaValue result. |
boolean |
eq_b(LuaValue val)
Equals: Perform equality comparison with another value including metatag processing using EQ ,
and return java boolean |
LuaValue |
eq(LuaValue val)
Equals: Perform equality comparison with another value including metatag processing using EQ . |
boolean |
equals(java.lang.Object o)
|
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 |
gt_b(LuaValue rhs)
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean. |
LuaValue |
gt(double rhs)
Greater than: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue . |
LuaValue |
gt(int rhs)
Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue . |
LuaValue |
gt(LuaValue rhs)
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue . |
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 |
gteq_b(LuaValue rhs)
Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean. |
LuaValue |
gteq(double rhs)
Greater than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue . |
LuaValue |
gteq(int rhs)
Greater than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue . |
LuaValue |
gteq(LuaValue rhs)
Greater than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue . |
int |
hashCode()
|
boolean |
islong()
Check if this is a number and is representable by java long
without rounding or truncation |
boolean |
isnumber()
Check if this is a number |
boolean |
isstring()
Check if this is a string |
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 |
lt_b(LuaValue rhs)
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean. |
LuaValue |
lt(double rhs)
Less than: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue . |
LuaValue |
lt(int rhs)
Less than: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue . |
LuaValue |
lt(LuaValue rhs)
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue . |
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 |
lteq_b(LuaValue rhs)
Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning java boolean. |
LuaValue |
lteq(double rhs)
Less than or equals: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue . |
LuaValue |
lteq(int rhs)
Less than or equals: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue . |
LuaValue |
lteq(LuaValue rhs)
Less than or equals: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue . |
LuaValue |
mod(double rhs)
Modulo: Perform numeric modulo operation with another value of double type without metatag processing |
LuaValue |
mod(int rhs)
Modulo: Perform numeric modulo operation with another value of int type without metatag processing |
LuaValue |
mod(LuaValue rhs)
Modulo: Perform numeric modulo operation with another value of unknown type, including metatag processing. |
LuaValue |
modFrom(double lhs)
Reverse-modulo: Perform numeric modulo operation from another value with metatag processing |
LuaValue |
mul(double lhs)
Multiply: Perform numeric multiply operation with another value of double type with metatag processing |
LuaValue |
mul(int lhs)
Multiply: Perform numeric multiply operation with another value of int type with metatag processing |
LuaValue |
mul(LuaValue rhs)
Multiply: Perform numeric multiply operation with another value of unknown type, including metatag processing. |
LuaValue |
neg()
Unary minus: return negative value (-this) as defined by lua unary minus operator |
double |
optdouble(double defval)
Check that optional argument is a number or string convertible to number and return as double |
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 |
java.lang.String |
optjstring(java.lang.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 |
LuaValue |
pow(double rhs)
Raise to power: Raise this value to a power of double type with metatag processing |
LuaValue |
pow(int rhs)
Raise to power: Raise this value to a power of int type with metatag processing |
LuaValue |
pow(LuaValue rhs)
Raise to power: Raise this value to a power including metatag processing. |
LuaValue |
powWith(double lhs)
Reverse-raise to power: Raise another value of double type to this power with metatag processing |
LuaValue |
powWith(int lhs)
Reverse-raise to power: Raise another value of double type to this power with metatag processing |
boolean |
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 |
raweq(LuaValue val)
Equals: Perform direct equality comparison with another value without metatag processing. |
int |
strcmp(LuaString rhs)
Perform string comparison with another value known to be a LuaString
using string comparison based on byte values. |
LuaString |
strvalue()
Convert this value to a string if it is a LuaString or LuaNumber ,
or throw a LuaError if it is not |
LuaValue |
sub(double rhs)
Subtract: Perform numeric subtract operation with another value of double type with metatag processing |
LuaValue |
sub(int rhs)
Subtract: Perform numeric subtract operation with another value of int type with metatag processing |
LuaValue |
sub(LuaValue rhs)
Subtract: Perform numeric subtract operation with another value of unknown type, including metatag processing. |
LuaValue |
subFrom(double lhs)
Reverse-subtract: Perform numeric subtract operation from an int value with metatag processing |
byte |
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. |
java.lang.String |
tojstring()
Convert to human readable String for any type. |
long |
tolong()
Convert to long if numeric, or 0 if not. |
LuaValue |
tonumber()
Conditionally convert to lua number without throwing errors. |
short |
toshort()
Convert to short if numeric, or 0 if not. |
LuaValue |
tostring()
Conditionally convert to lua string without throwing errors. |
static LuaNumber |
valueOf(double d)
|
Methods inherited from class org.luaj.vm2.LuaNumber |
---|
checknumber, concat, concat, concatTo, concatTo, getmetatable, type, typename |
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, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final LuaDouble NAN
public static final LuaDouble POSINF
public static final LuaDouble NEGINF
public static final java.lang.String JSTR_NAN
public static final java.lang.String JSTR_POSINF
public static final java.lang.String JSTR_NEGINF
Method Detail |
---|
public static LuaNumber valueOf(double d)
public int hashCode()
hashCode
in class java.lang.Object
public boolean islong()
LuaValue
this
is a number
and is representable by java long
without rounding or truncation
islong
in class LuaValue
number
meaning derives from LuaNumber
or derives from LuaString
and is convertible to a number,
and can be represented by long,
otherwise falseLuaValue.tonumber()
,
LuaValue.checklong()
,
LuaValue.optlong(long)
,
LuaValue.TNUMBER
public byte tobyte()
LuaValue
tobyte
in class LuaValue
LuaValue.toint()
,
LuaValue.todouble()
,
#optbyte(byte)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public char tochar()
LuaValue
tochar
in class LuaValue
LuaValue.toint()
,
LuaValue.todouble()
,
#optchar(char)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public double todouble()
LuaValue
todouble
in class LuaValue
LuaValue.toint()
,
LuaValue.tobyte()
,
LuaValue.tochar()
,
LuaValue.toshort()
,
LuaValue.tolong()
,
LuaValue.tofloat()
,
LuaValue.optdouble(double)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public float tofloat()
LuaValue
tofloat
in class LuaValue
LuaValue.toint()
,
LuaValue.todouble()
,
#optfloat(float)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public int toint()
LuaValue
toint
in class LuaValue
LuaValue.tobyte()
,
LuaValue.tochar()
,
LuaValue.toshort()
,
LuaValue.tolong()
,
LuaValue.tofloat()
,
LuaValue.todouble()
,
LuaValue.optint(int)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public long tolong()
LuaValue
tolong
in class LuaValue
LuaValue.isint()
,
LuaValue.isinttype()
,
LuaValue.toint()
,
LuaValue.todouble()
,
LuaValue.optlong(long)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public short toshort()
LuaValue
toshort
in class LuaValue
LuaValue.toint()
,
LuaValue.todouble()
,
#optshort(short)
,
LuaValue.checknumber()
,
LuaValue.isnumber()
,
TNUMBER
public double optdouble(double defval)
LuaValue
optdouble
in class LuaValue
defval
- double to return if this
is nil or none
this
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.TNUMBER
public int optint(int defval)
LuaValue
optint
in class LuaValue
defval
- int to return if this
is nil or none
this
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.TNUMBER
public LuaInteger optinteger(LuaInteger defval)
LuaValue
LuaInteger
optinteger
in class LuaValue
defval
- LuaInteger
to return if this
is nil or none
this
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.TNUMBER
public long optlong(long defval)
LuaValue
optlong
in class LuaValue
defval
- long to return if this
is nil or none
this
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.TNUMBER
public LuaInteger checkinteger()
LuaValue
LuaError
if not numeric
Values that are LuaNumber
will be cast to int and may lose precision.
Values that are LuaString
that can be converted to a number will be converted,
then cast to int, so may also lose precision.
checkinteger
in class LuaValue
LuaInteger
if numericLuaValue.checkint()
,
LuaValue.checklong()
,
LuaValue.checkdouble()
,
LuaValue.optinteger(LuaInteger)
,
LuaValue.TNUMBER
public LuaValue neg()
LuaValue
(-this)
as defined by lua unary minus operator
neg
in class LuaValue
LuaBoolean
if boolean or nil,
numeric inverse as if numeric,
or metatag processing result if UNM
metatag is definedpublic boolean equals(java.lang.Object o)
equals
in class LuaValue
public LuaValue eq(LuaValue val)
LuaValue
EQ
.
eq
in class LuaValue
val
- The value to compare with.
TRUE
if values are comparable and (this == rhs)
,
FALSE
if comparable but not equal,
LuaValue
if metatag processing occurs.LuaValue.eq_b(LuaValue)
,
LuaValue.raweq(LuaValue)
,
LuaValue.neq(LuaValue)
,
LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue)
,
LuaValue.EQ
public boolean eq_b(LuaValue val)
LuaValue
EQ
,
and return java boolean
eq_b
in class LuaValue
val
- The value to compare with.
(this == rhs)
,
false if comparable but not equal,
result converted to java boolean if metatag processing occurs.LuaValue.eq(LuaValue)
,
LuaValue.raweq(LuaValue)
,
LuaValue.neq_b(LuaValue)
,
LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue)
,
LuaValue.EQ
public boolean raweq(LuaValue val)
LuaValue
raweq
in class LuaValue
val
- The value to compare with.
(this == rhs)
, false otherwiseLuaValue.eq(LuaValue)
,
LuaValue.raweq(LuaUserdata)
,
LuaValue.raweq(LuaString)
,
LuaValue.raweq(double)
,
LuaValue.raweq(int)
,
LuaValue.EQ
public boolean raweq(double val)
LuaValue
raweq
in class LuaValue
val
- The double value to compare with.
this
is a LuaNumber
whose value equals val,
otherwise falsepublic boolean raweq(int val)
LuaValue
raweq
in class LuaValue
val
- The double value to compare with.
this
is a LuaNumber
whose value equals val,
otherwise falsepublic LuaValue add(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
add
in class LuaValue
rhs
- The right-hand-side value to perform the add with
(this + rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue add(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
add
in class LuaValue
lhs
- The right-hand-side value to perform the add with
(this + rhs)
if this is numericLuaValue.add(LuaValue)
public LuaValue sub(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
sub
in class LuaValue
rhs
- The right-hand-side value to perform the subtract with
(this - rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue sub(double rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
sub
in class LuaValue
rhs
- The right-hand-side value to perform the subtract with
(this - rhs)
if this is numericLuaValue.sub(LuaValue)
public LuaValue sub(int rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
sub
in class LuaValue
rhs
- The right-hand-side value to perform the subtract with
(this - rhs)
if this is numericLuaValue.sub(LuaValue)
public LuaValue subFrom(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
subFrom
in class LuaValue
lhs
- The left-hand-side value from which to perform the subtraction
(lhs - this)
if this is numericLuaValue.sub(LuaValue)
,
LuaValue.sub(double)
,
LuaValue.sub(int)
public LuaValue mul(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
mul
in class LuaValue
rhs
- The right-hand-side value to perform the multiply with
(this * rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue mul(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
mul
in class LuaValue
lhs
- The right-hand-side value to perform the multiply with
(this * rhs)
if this is numericLuaValue.mul(LuaValue)
public LuaValue mul(int lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
mul
in class LuaValue
lhs
- The right-hand-side value to perform the multiply with
(this * rhs)
if this is numericLuaValue.mul(LuaValue)
public LuaValue pow(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
pow
in class LuaValue
rhs
- The power to raise this value to
(this ^ rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue pow(double rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
pow
in class LuaValue
rhs
- The power to raise this value to
(this ^ rhs)
if this is numericLuaValue.pow(LuaValue)
public LuaValue pow(int rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
pow
in class LuaValue
rhs
- The power to raise this value to
(this ^ rhs)
if this is numericLuaValue.pow(LuaValue)
public LuaValue powWith(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
powWith
in class LuaValue
lhs
- The left-hand-side value which will be raised to this power
(lhs ^ this)
if this is numericLuaValue.pow(LuaValue)
,
LuaValue.pow(double)
,
LuaValue.pow(int)
public LuaValue powWith(int lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
powWith
in class LuaValue
lhs
- The left-hand-side value which will be raised to this power
(lhs ^ this)
if this is numericLuaValue.pow(LuaValue)
,
LuaValue.pow(double)
,
LuaValue.pow(int)
public LuaValue div(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
div
in class LuaValue
rhs
- The right-hand-side value to perform the divulo with
(this / rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue div(double rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
For metatag processing LuaValue.div(LuaValue)
must be used
div
in class LuaValue
rhs
- The right-hand-side value to perform the divulo with
(this / rhs)
if this is numericLuaValue.div(LuaValue)
public LuaValue div(int rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
For metatag processing LuaValue.div(LuaValue)
must be used
div
in class LuaValue
rhs
- The right-hand-side value to perform the divulo with
(this / rhs)
if this is numericLuaValue.div(LuaValue)
public LuaValue divInto(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
divInto
in class LuaValue
lhs
- The left-hand-side value which will be divided by this
(lhs / this)
if this is numericLuaValue.div(LuaValue)
,
LuaValue.div(double)
,
LuaValue.div(int)
public LuaValue mod(LuaValue rhs)
LuaValue
Each operand must derive from LuaNumber
or derive from LuaString
and be convertible to a number
mod
in class LuaValue
rhs
- The right-hand-side value to perform the modulo with
(this % rhs)
if both are numeric,
or LuaValue
if metatag processing occursLuaValue.arithmt(LuaValue, LuaValue)
public LuaValue mod(double rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
For metatag processing LuaValue.mod(LuaValue)
must be used
mod
in class LuaValue
rhs
- The right-hand-side value to perform the modulo with
(this % rhs)
if this is numericLuaValue.mod(LuaValue)
public LuaValue mod(int rhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
For metatag processing LuaValue.mod(LuaValue)
must be used
mod
in class LuaValue
rhs
- The right-hand-side value to perform the modulo with
(this % rhs)
if this is numericLuaValue.mod(LuaValue)
public LuaValue modFrom(double lhs)
LuaValue
this
must derive from LuaNumber
or derive from LuaString
and be convertible to a number
modFrom
in class LuaValue
lhs
- The left-hand-side value which will be modulo'ed by this
(lhs % this)
if this is numericLuaValue.mod(LuaValue)
,
LuaValue.mod(double)
,
LuaValue.mod(int)
public static LuaValue ddiv(double lhs, double rhs)
LuaValue
result.
lhs
- Left-hand-side of the division.rhs
- Right-hand-side of the division.
LuaValue
for the result of the division,
taking into account positive and negiative infinity, and Nanddiv_d(double, double)
public static double ddiv_d(double lhs, double rhs)
lhs
- Left-hand-side of the division.rhs
- Right-hand-side of the division.
ddiv(double, double)
public static LuaValue dmod(double lhs, double rhs)
LuaValue
result.
lhs
- Left-hand-side of the modulo.rhs
- Right-hand-side of the modulo.
LuaValue
for the result of the modulo,
using lua's rules for modulodmod_d(double, double)
public static double dmod_d(double lhs, double rhs)
lhs
- Left-hand-side of the modulo.rhs
- Right-hand-side of the modulo.
dmod(double, double)
public LuaValue lt(LuaValue rhs)
LuaValue
LuaValue
.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
lt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this < rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue lt(double rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
lt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this < rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue lt(int rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
lt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this < rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lt_b(LuaValue rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
lt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this < rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lt_b(int rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
lt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this < rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lt_b(double rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
lt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this < rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue lteq(LuaValue rhs)
LuaValue
LuaValue
.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
lteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this <= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue lteq(double rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
lteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this <= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue lteq(int rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
lteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this <= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lteq_b(LuaValue rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
lteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this <= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lteq_b(int rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
lteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this <= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean lteq_b(double rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
lteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this <= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gt(LuaValue rhs)
LuaValue
LuaValue
.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
gt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this > rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gt(double rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
gt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this > rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gt(int rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
gt
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this > rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gt_b(LuaValue rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
gt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this > rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gt_b(int rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
gt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this > rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gt_b(double rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
gt_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this > rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gteq(LuaValue rhs)
LuaValue
LuaValue
.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
gteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this >= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gteq(double rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
gteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this >= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public LuaValue gteq(int rhs)
LuaValue
LuaValue
.
To be comparable, this must derive from LuaNumber
.
gteq
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
TRUE
if (this >= rhs)
, FALSE
if not,
or LuaValue
if metatag processing occursLuaValue.gteq_b(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gteq_b(LuaValue rhs)
LuaValue
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber
.
gteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this >= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(LuaValue)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gteq_b(int rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
gteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this >= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(int)
,
LuaValue.comparemt(LuaValue, LuaValue)
public boolean gteq_b(double rhs)
LuaValue
To be comparable, this must derive from LuaNumber
.
gteq_b
in class LuaValue
rhs
- The right-hand-side value to perform the comparison with
(this >= rhs)
, false if not,
and boolean interpreation of result if metatag processing occurs.LuaValue.gteq(double)
,
LuaValue.comparemt(LuaValue, LuaValue)
public int strcmp(LuaString rhs)
LuaValue
LuaString
using string comparison based on byte values.
Only strings can be compared, meaning
each operand must derive from LuaString
.
strcmp
in class LuaValue
rhs
- The right-hand-side value to perform the comparison withpublic java.lang.String tojstring()
LuaValue
tojstring
in class LuaValue
LuaValue.tostring()
,
LuaValue.optjstring(String)
,
LuaValue.checkjstring()
,
LuaValue.isstring()
,
TSTRING
public LuaString strvalue()
LuaValue
LuaString
or LuaNumber
,
or throw a LuaError
if it is not
strvalue
in class LuaValue
LuaString
corresponding to the value if a string or numberpublic LuaString optstring(LuaString defval)
LuaValue
LuaString
optstring
in class LuaValue
defval
- LuaString
to return if this
is nil or none
this
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.TSTRING
public LuaValue tostring()
LuaValue
In lua all numbers are strings, so this function will return
the LuaValue
this
if it is a string or number,
and NIL
for all other cases.
This allows values to be tested for their "string-ness" without the penalty of throwing exceptions.
tostring
in class LuaValue
this
if it is a LuaString
or LuaNumber
,
otherwise NIL
LuaValue.tonumber()
,
LuaValue.tojstring()
,
LuaValue.optstring(LuaString)
,
LuaValue.checkstring()
,
LuaValue.toString()
public java.lang.String optjstring(java.lang.String defval)
LuaValue
optjstring
in class LuaValue
defval
- LuaString
to return if this
is nil or none
this
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.TSTRING
public LuaNumber optnumber(LuaNumber defval)
LuaValue
LuaNumber
optnumber
in class LuaNumber
defval
- LuaNumber
to return if this
is nil or none
this
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.TNUMBER
public boolean isnumber()
LuaValue
this
is a number
isnumber
in class LuaNumber
number
,
meaning derives from LuaNumber
or derives from LuaString
and is convertible to a number,
otherwise falseLuaValue.tonumber()
,
LuaValue.checknumber()
,
LuaValue.optnumber(LuaNumber)
,
LuaValue.TNUMBER
public boolean isstring()
LuaValue
this
is a string
isstring
in class LuaNumber
string
,
meaning derives from LuaString
or LuaNumber
,
otherwise falseLuaValue.tostring()
,
LuaValue.checkstring()
,
LuaValue.optstring(LuaString)
,
LuaValue.TSTRING
public LuaValue tonumber()
LuaValue
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,
and 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.
tonumber
in class LuaNumber
this
if it is a LuaNumber
or LuaString
that can be converted to a number,
otherwise LuaValue.NIL
LuaValue.tostring()
,
LuaValue.optnumber(LuaNumber)
,
LuaValue.checknumber()
,
LuaValue.toint()
,
LuaValue.todouble()
public int checkint()
LuaValue
LuaError
if not numeric
Values that are LuaNumber
will be cast to int and may lose precision.
Values that are LuaString
that can be converted to a number will be converted,
then cast to int, so may also lose precision.
checkint
in class LuaValue
LuaValue.checkinteger()
,
LuaValue.checklong()
,
LuaValue.checkdouble()
,
LuaValue.optint(int)
,
LuaValue.TNUMBER
public long checklong()
LuaValue
LuaError
if not numeric
Values that are LuaNumber
will be cast to long and may lose precision.
Values that are LuaString
that can be converted to a number will be converted,
then cast to long, so may also lose precision.
checklong
in class LuaValue
LuaValue.checkint()
,
LuaValue.checkinteger()
,
LuaValue.checkdouble()
,
LuaValue.optlong(long)
,
LuaValue.TNUMBER
public LuaNumber checknumber()
LuaValue
LuaError
Values that are LuaString
that can be converted to a number will be converted and returned.
checknumber
in class LuaNumber
LuaNumber
if numericLuaValue.checkint()
,
LuaValue.checkinteger()
,
LuaValue.checkdouble()
,
LuaValue.checklong()
,
LuaValue.optnumber(LuaNumber)
,
LuaValue.TNUMBER
public double checkdouble()
LuaValue
LuaError
if not numeric
Values that are LuaNumber
and values that are LuaString
that can be converted to a number will be converted to double.
checkdouble
in class LuaValue
LuaValue.checkint()
,
LuaValue.checkinteger()
,
LuaValue.checklong()
,
LuaValue.optdouble(double)
,
LuaValue.TNUMBER
public java.lang.String checkjstring()
LuaValue
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.
checkjstring
in class LuaValue
LuaValue.checkstring()
,
LuaValue.optjstring(String)
,
LuaValue.tojstring()
,
LuaValue.isstring()
,
LuaValue.TSTRING
public LuaString checkstring()
LuaValue
LuaError
if it is not.
In lua all numbers are strings, so this will succeed for
anything that derives from LuaString
or LuaNumber
.
Numbers will be converted to LuaString
.
checkstring
in class LuaValue
LuaString
representation of the value if it is a LuaString
or LuaNumber
LuaValue.checkjstring()
,
LuaValue.optstring(LuaString)
,
LuaValue.tostring()
,
LuaValue.isstring()
,
LuaValue.TSTRING
public LuaValue checkvalidkey()
LuaValue
LuaError
if not
checkvalidkey
in class LuaValue
this
if valid as a table keyLuaValue.isnil()
,
LuaValue.isinttype()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |