org.luaj.vm2
Class LuaDouble

java.lang.Object
  extended by org.luaj.vm2.Varargs
      extended by org.luaj.vm2.LuaValue
          extended by org.luaj.vm2.LuaNumber
              extended by org.luaj.vm2.LuaDouble

public class LuaDouble
extends LuaNumber

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

See Also:
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, ENV, 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.
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 LuaValue.EQ, and return java boolean
 LuaValue eq(LuaValue val)
          Equals: Perform equality comparison with another value including metatag processing using LuaValue.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 isvalidkey()
          Return true if this is a valid key in a table index operation.
 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.LuaValue
add, and, arg, arg1, argerror, argerror, aritherror, aritherror, arithmt, arithmtwith, assert_, buffer, call, call, call, call, call, callmt, checkboolean, checkclosure, checkfunction, checkglobals, checkmetatag, checknotnil, checktable, checkthread, checkuserdata, checkuserdata, compareerror, compareerror, comparemt, concatmt, concatTo, eqmtcall, error, get, get, get, gettable, illegal, 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, lenerror, length, listOf, listOf, load, metatableOf, metatag, method, method, method, method, method, method, narg, neq_b, neq, 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, settable, strcmp, strongvalue, subargs, subFrom, tableOf, tableOf, tableOf, tableOf, tableOf, tableOf, tailcallOf, testfor_b, toboolean, toString, touserdata, touserdata, typerror, unimplemented, userdataOf, userdataOf, valueOf, valueOf, valueOf, valueOf, valueOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf, varargsOf
 
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, 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

NAN

public static final LuaDouble NAN
Constant LuaDouble representing NaN (not a number)


POSINF

public static final LuaDouble POSINF
Constant LuaDouble representing positive infinity


NEGINF

public static final LuaDouble NEGINF
Constant LuaDouble representing negative infinity


JSTR_NAN

public static final java.lang.String JSTR_NAN
Constant String representation for NaN (not a number), "nan"

See Also:
Constant Field Values

JSTR_POSINF

public static final java.lang.String JSTR_POSINF
Constant String representation for positive infinity, "inf"

See Also:
Constant Field Values

JSTR_NEGINF

public static final java.lang.String JSTR_NEGINF
Constant String representation for negative infinity, "-inf"

See Also:
Constant Field Values
Method Detail

valueOf

public static LuaNumber valueOf(double d)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

islong

public boolean islong()
Description copied from class: LuaValue
Check if this is a number and is representable by java long without rounding or truncation

Overrides:
islong in class LuaValue
Returns:
true if this is a number meaning derives from LuaNumber or derives from LuaString and is convertible to a number, and can be represented by long, otherwise false
See Also:
LuaValue.tonumber(), LuaValue.checklong(), LuaValue.optlong(long), LuaValue.TNUMBER

tobyte

public byte tobyte()
Description copied from class: LuaValue
Convert to byte if numeric, or 0 if not.

Overrides:
tobyte in class LuaValue
Returns:
Value cast to byte if number or string convertible to number, otherwise 0
See Also:
LuaValue.toint(), LuaValue.todouble(), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

tochar

public char tochar()
Description copied from class: LuaValue
Convert to char if numeric, or 0 if not.

Overrides:
tochar in class LuaValue
Returns:
Value cast to char if number or string convertible to number, otherwise 0
See Also:
LuaValue.toint(), LuaValue.todouble(), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

todouble

public double todouble()
Description copied from class: LuaValue
Convert to double if numeric, or 0 if not.

Overrides:
todouble in class LuaValue
Returns:
Value cast to double if number or string convertible to number, otherwise 0
See Also:
LuaValue.toint(), LuaValue.tobyte(), LuaValue.tochar(), LuaValue.toshort(), LuaValue.tolong(), LuaValue.tofloat(), LuaValue.optdouble(double), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

tofloat

public float tofloat()
Description copied from class: LuaValue
Convert to float if numeric, or 0 if not.

Overrides:
tofloat in class LuaValue
Returns:
Value cast to float if number or string convertible to number, otherwise 0
See Also:
LuaValue.toint(), LuaValue.todouble(), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

toint

public int toint()
Description copied from class: LuaValue
Convert to int if numeric, or 0 if not.

Overrides:
toint in class LuaValue
Returns:
Value cast to int if number or string convertible to number, otherwise 0
See Also:
LuaValue.tobyte(), LuaValue.tochar(), LuaValue.toshort(), LuaValue.tolong(), LuaValue.tofloat(), LuaValue.todouble(), LuaValue.optint(int), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

tolong

public long tolong()
Description copied from class: LuaValue
Convert to long if numeric, or 0 if not.

Overrides:
tolong in class LuaValue
Returns:
Value cast to long if number or string convertible to number, otherwise 0
See Also:
LuaValue.isint(), LuaValue.isinttype(), LuaValue.toint(), LuaValue.todouble(), LuaValue.optlong(long), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

toshort

public short toshort()
Description copied from class: LuaValue
Convert to short if numeric, or 0 if not.

Overrides:
toshort in class LuaValue
Returns:
Value cast to short if number or string convertible to number, otherwise 0
See Also:
LuaValue.toint(), LuaValue.todouble(), LuaValue.checknumber(), LuaValue.isnumber(), LuaValue.TNUMBER

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

Overrides:
optdouble in class LuaValue
Parameters:
defval - double to return if this is nil or none
Returns:
this cast to double if numeric, defval if nil or none, throws LuaError otherwise
See Also:
LuaValue.optint(int), LuaValue.optinteger(LuaInteger), LuaValue.checkdouble(), LuaValue.todouble(), LuaValue.tonumber(), LuaValue.isnumber(), LuaValue.TNUMBER

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

Overrides:
optint in class LuaValue
Parameters:
defval - int to return if this is nil or none
Returns:
this cast to int if numeric, defval if nil or none, throws LuaError otherwise
See Also:
LuaValue.optdouble(double), LuaValue.optlong(long), LuaValue.optinteger(LuaInteger), LuaValue.checkint(), LuaValue.toint(), LuaValue.tonumber(), LuaValue.isnumber(), LuaValue.TNUMBER

optinteger

public LuaInteger optinteger(LuaInteger defval)
Description copied from class: LuaValue
Check that optional argument is a number or string convertible to number and return as LuaInteger

Overrides:
optinteger in class LuaValue
Parameters:
defval - LuaInteger to return if this is nil or none
Returns:
this converted and wrapped in LuaInteger if numeric, defval if nil or none, throws LuaError otherwise
See Also:
LuaValue.optdouble(double), LuaValue.optint(int), LuaValue.checkint(), LuaValue.toint(), LuaValue.tonumber(), LuaValue.isnumber(), LuaValue.TNUMBER

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

Overrides:
optlong in class LuaValue
Parameters:
defval - long to return if this is nil or none
Returns:
this cast to long if numeric, defval if nil or none, throws LuaError otherwise
See Also:
LuaValue.optdouble(double), LuaValue.optint(int), LuaValue.checkint(), LuaValue.toint(), LuaValue.tonumber(), LuaValue.isnumber(), LuaValue.TNUMBER

checkinteger

public LuaInteger checkinteger()
Description copied from class: LuaValue
Check that the value is numeric, and convert and cast value to int, or throw 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.

Overrides:
checkinteger in class LuaValue
Returns:
value cast to a int and wrapped in LuaInteger if numeric
See Also:
LuaValue.checkint(), LuaValue.checklong(), LuaValue.checkdouble(), LuaValue.optinteger(LuaInteger), LuaValue.TNUMBER

neg

public LuaValue neg()
Description copied from class: LuaValue
Unary minus: return negative value (-this) as defined by lua unary minus operator

Overrides:
neg in class LuaValue
Returns:
boolean inverse as LuaBoolean if boolean or nil, numeric inverse as LuaNumber if numeric, or metatag processing result if LuaValue.UNM metatag is defined

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class LuaValue

eq

public LuaValue eq(LuaValue val)
Description copied from class: LuaValue
Equals: Perform equality comparison with another value including metatag processing using LuaValue.EQ.

Overrides:
eq in class LuaValue
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:
LuaValue.eq_b(LuaValue), LuaValue.raweq(LuaValue), LuaValue.neq(LuaValue), LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue), LuaValue.EQ

eq_b

public boolean eq_b(LuaValue val)
Description copied from class: LuaValue
Equals: Perform equality comparison with another value including metatag processing using LuaValue.EQ, and return java boolean

Overrides:
eq_b in class LuaValue
Parameters:
val - The value to compare with.
Returns:
true if values are comparable and (this == rhs), false if comparable but not equal, result converted to java boolean if metatag processing occurs.
See Also:
LuaValue.eq(LuaValue), LuaValue.raweq(LuaValue), LuaValue.neq_b(LuaValue), LuaValue.eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue), LuaValue.EQ

raweq

public boolean raweq(LuaValue val)
Description copied from class: LuaValue
Equals: Perform direct equality comparison with another value without metatag processing.

Overrides:
raweq in class LuaValue
Parameters:
val - The value to compare with.
Returns:
true if (this == rhs), false otherwise
See Also:
LuaValue.eq(LuaValue), LuaValue.raweq(LuaUserdata), LuaValue.raweq(LuaString), LuaValue.raweq(double), LuaValue.raweq(int), LuaValue.EQ

raweq

public boolean raweq(double val)
Description copied from class: LuaValue
Equals: Perform direct equality comparison with a double value without metatag processing.

Overrides:
raweq in class LuaValue
Parameters:
val - The double value to compare with.
Returns:
true if this is a LuaNumber whose value equals val, otherwise false

raweq

public boolean raweq(int val)
Description copied from class: LuaValue
Equals: Perform direct equality comparison with a int value without metatag processing.

Overrides:
raweq in class LuaValue
Parameters:
val - The double value to compare with.
Returns:
true if this is a LuaNumber whose value equals val, otherwise false

add

public LuaValue add(LuaValue rhs)
Description copied from class: LuaValue
Add: Perform numeric add operation with another value including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
add in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the add with
Returns:
value of (this + rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

add

public LuaValue add(double lhs)
Description copied from class: LuaValue
Add: Perform numeric add operation with another value of double type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
add in class LuaValue
Parameters:
lhs - The right-hand-side value to perform the add with
Returns:
value of (this + rhs) if this is numeric
See Also:
LuaValue.add(LuaValue)

sub

public LuaValue sub(LuaValue rhs)
Description copied from class: LuaValue
Subtract: Perform numeric subtract operation with another value of unknown type, including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
sub in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the subtract with
Returns:
value of (this - rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

sub

public LuaValue sub(double rhs)
Description copied from class: LuaValue
Subtract: Perform numeric subtract operation with another value of double type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
sub in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the subtract with
Returns:
value of (this - rhs) if this is numeric
See Also:
LuaValue.sub(LuaValue)

sub

public LuaValue sub(int rhs)
Description copied from class: LuaValue
Subtract: Perform numeric subtract operation with another value of int type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
sub in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the subtract with
Returns:
value of (this - rhs) if this is numeric
See Also:
LuaValue.sub(LuaValue)

subFrom

public LuaValue subFrom(double lhs)
Description copied from class: LuaValue
Reverse-subtract: Perform numeric subtract operation from an int value with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
subFrom in class LuaValue
Parameters:
lhs - The left-hand-side value from which to perform the subtraction
Returns:
value of (lhs - this) if this is numeric
See Also:
LuaValue.sub(LuaValue), LuaValue.sub(double), LuaValue.sub(int)

mul

public LuaValue mul(LuaValue rhs)
Description copied from class: LuaValue
Multiply: Perform numeric multiply operation with another value of unknown type, including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
mul in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the multiply with
Returns:
value of (this * rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

mul

public LuaValue mul(double lhs)
Description copied from class: LuaValue
Multiply: Perform numeric multiply operation with another value of double type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
mul in class LuaValue
Parameters:
lhs - The right-hand-side value to perform the multiply with
Returns:
value of (this * rhs) if this is numeric
See Also:
LuaValue.mul(LuaValue)

mul

public LuaValue mul(int lhs)
Description copied from class: LuaValue
Multiply: Perform numeric multiply operation with another value of int type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
mul in class LuaValue
Parameters:
lhs - The right-hand-side value to perform the multiply with
Returns:
value of (this * rhs) if this is numeric
See Also:
LuaValue.mul(LuaValue)

pow

public LuaValue pow(LuaValue rhs)
Description copied from class: LuaValue
Raise to power: Raise this value to a power including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
pow in class LuaValue
Parameters:
rhs - The power to raise this value to
Returns:
value of (this ^ rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

pow

public LuaValue pow(double rhs)
Description copied from class: LuaValue
Raise to power: Raise this value to a power of double type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
pow in class LuaValue
Parameters:
rhs - The power to raise this value to
Returns:
value of (this ^ rhs) if this is numeric
See Also:
LuaValue.pow(LuaValue)

pow

public LuaValue pow(int rhs)
Description copied from class: LuaValue
Raise to power: Raise this value to a power of int type with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
pow in class LuaValue
Parameters:
rhs - The power to raise this value to
Returns:
value of (this ^ rhs) if this is numeric
See Also:
LuaValue.pow(LuaValue)

powWith

public LuaValue powWith(double lhs)
Description copied from class: LuaValue
Reverse-raise to power: Raise another value of double type to this power with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
powWith in class LuaValue
Parameters:
lhs - The left-hand-side value which will be raised to this power
Returns:
value of (lhs ^ this) if this is numeric
See Also:
LuaValue.pow(LuaValue), LuaValue.pow(double), LuaValue.pow(int)

powWith

public LuaValue powWith(int lhs)
Description copied from class: LuaValue
Reverse-raise to power: Raise another value of double type to this power with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
powWith in class LuaValue
Parameters:
lhs - The left-hand-side value which will be raised to this power
Returns:
value of (lhs ^ this) if this is numeric
See Also:
LuaValue.pow(LuaValue), LuaValue.pow(double), LuaValue.pow(int)

div

public LuaValue div(LuaValue rhs)
Description copied from class: LuaValue
Divide: Perform numeric divide operation by another value of unknown type, including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
div in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the divulo with
Returns:
value of (this / rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

div

public LuaValue div(double rhs)
Description copied from class: LuaValue
Divide: Perform numeric divide operation by another value of double type without metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

For metatag processing LuaValue.div(LuaValue) must be used

Overrides:
div in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the divulo with
Returns:
value of (this / rhs) if this is numeric
See Also:
LuaValue.div(LuaValue)

div

public LuaValue div(int rhs)
Description copied from class: LuaValue
Divide: Perform numeric divide operation by another value of int type without metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

For metatag processing LuaValue.div(LuaValue) must be used

Overrides:
div in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the divulo with
Returns:
value of (this / rhs) if this is numeric
See Also:
LuaValue.div(LuaValue)

divInto

public LuaValue divInto(double lhs)
Description copied from class: LuaValue
Reverse-divide: Perform numeric divide operation into another value with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
divInto in class LuaValue
Parameters:
lhs - The left-hand-side value which will be divided by this
Returns:
value of (lhs / this) if this is numeric
See Also:
LuaValue.div(LuaValue), LuaValue.div(double), LuaValue.div(int)

mod

public LuaValue mod(LuaValue rhs)
Description copied from class: LuaValue
Modulo: Perform numeric modulo operation with another value of unknown type, including metatag processing.

Each operand must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
mod in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the modulo with
Returns:
value of (this % rhs) if both are numeric, or LuaValue if metatag processing occurs
See Also:
LuaValue.arithmt(LuaValue, LuaValue)

mod

public LuaValue mod(double rhs)
Description copied from class: LuaValue
Modulo: Perform numeric modulo operation with another value of double type without metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

For metatag processing LuaValue.mod(LuaValue) must be used

Overrides:
mod in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the modulo with
Returns:
value of (this % rhs) if this is numeric
See Also:
LuaValue.mod(LuaValue)

mod

public LuaValue mod(int rhs)
Description copied from class: LuaValue
Modulo: Perform numeric modulo operation with another value of int type without metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

For metatag processing LuaValue.mod(LuaValue) must be used

Overrides:
mod in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the modulo with
Returns:
value of (this % rhs) if this is numeric
See Also:
LuaValue.mod(LuaValue)

modFrom

public LuaValue modFrom(double lhs)
Description copied from class: LuaValue
Reverse-modulo: Perform numeric modulo operation from another value with metatag processing

this must derive from LuaNumber or derive from LuaString and be convertible to a number

Overrides:
modFrom in class LuaValue
Parameters:
lhs - The left-hand-side value which will be modulo'ed by this
Returns:
value of (lhs % this) if this is numeric
See Also:
LuaValue.mod(LuaValue), LuaValue.mod(double), LuaValue.mod(int)

ddiv

public static LuaValue ddiv(double lhs,
                            double rhs)
Divide two double numbers according to lua math, and return a LuaValue 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(double, double)

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:
ddiv(double, double)

dmod

public static LuaValue dmod(double lhs,
                            double rhs)
Take modulo double numbers according to lua math, and return a LuaValue 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(double, double)

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:
dmod(double, double)

lt

public LuaValue lt(LuaValue rhs)
Description copied from class: LuaValue
Less than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue.

To be comparable, both operands must derive from LuaString or both must derive from LuaNumber.

Overrides:
lt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this < rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

lt

public LuaValue lt(double rhs)
Description copied from class: LuaValue
Less than: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
lt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this < rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(double), LuaValue.comparemt(LuaValue, LuaValue)

lt

public LuaValue lt(int rhs)
Description copied from class: LuaValue
Less than: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
lt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this < rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(int), LuaValue.comparemt(LuaValue, LuaValue)

lt_b

public boolean lt_b(LuaValue 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 from LuaNumber.

Overrides:
lt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this < rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
lt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this < rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(int), LuaValue.comparemt(LuaValue, LuaValue)

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 from LuaNumber.

Overrides:
lt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this < rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

lteq

public LuaValue lteq(LuaValue rhs)
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 LuaValue.

To be comparable, both operands must derive from LuaString or both must derive from LuaNumber.

Overrides:
lteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this <= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

lteq

public LuaValue lteq(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 LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
lteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this <= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(double), LuaValue.comparemt(LuaValue, LuaValue)

lteq

public LuaValue lteq(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 LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
lteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this <= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(int), LuaValue.comparemt(LuaValue, LuaValue)

lteq_b

public boolean lteq_b(LuaValue rhs)
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 from LuaNumber.

Overrides:
lteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this <= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
lteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this <= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(int), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
lteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this <= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(double), LuaValue.comparemt(LuaValue, LuaValue)

gt

public LuaValue gt(LuaValue rhs)
Description copied from class: LuaValue
Greater than: Perform numeric or string comparison with another value of unknown type, including metatag processing, and returning LuaValue.

To be comparable, both operands must derive from LuaString or both must derive from LuaNumber.

Overrides:
gt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this > rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

gt

public LuaValue gt(double rhs)
Description copied from class: LuaValue
Greater than: Perform numeric comparison with another value of double type, including metatag processing, and returning LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
gt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this > rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(double), LuaValue.comparemt(LuaValue, LuaValue)

gt

public LuaValue gt(int rhs)
Description copied from class: LuaValue
Greater than: Perform numeric comparison with another value of int type, including metatag processing, and returning LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
gt in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this > rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(int), LuaValue.comparemt(LuaValue, LuaValue)

gt_b

public boolean gt_b(LuaValue 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 from LuaNumber.

Overrides:
gt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this > rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
gt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this > rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(int), LuaValue.comparemt(LuaValue, LuaValue)

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 from LuaNumber.

Overrides:
gt_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this > rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

gteq

public LuaValue gteq(LuaValue rhs)
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 LuaValue.

To be comparable, both operands must derive from LuaString or both must derive from LuaNumber.

Overrides:
gteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this >= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

gteq

public LuaValue gteq(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 LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
gteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this >= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(double), LuaValue.comparemt(LuaValue, LuaValue)

gteq

public LuaValue gteq(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 LuaValue.

To be comparable, this must derive from LuaNumber.

Overrides:
gteq in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
LuaValue.TRUE if (this >= rhs), LuaValue.FALSE if not, or LuaValue if metatag processing occurs
See Also:
LuaValue.gteq_b(int), LuaValue.comparemt(LuaValue, LuaValue)

gteq_b

public boolean gteq_b(LuaValue rhs)
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 from LuaNumber.

Overrides:
gteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this >= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(LuaValue), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
gteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this >= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(int), LuaValue.comparemt(LuaValue, LuaValue)

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.

Overrides:
gteq_b in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
true if (this >= rhs), false if not, and boolean interpreation of result if metatag processing occurs.
See Also:
LuaValue.gteq(double), LuaValue.comparemt(LuaValue, LuaValue)

strcmp

public int strcmp(LuaString rhs)
Description copied from class: LuaValue
Perform string comparison with another value known to be a LuaString using string comparison based on byte values.

Only strings can be compared, meaning each operand must derive from LuaString.

Overrides:
strcmp in class LuaValue
Parameters:
rhs - The right-hand-side value to perform the comparison with
Returns:
int < 0 for (this < rhs), int > 0 for (this > rhs), or 0 when same string.

tojstring

public java.lang.String tojstring()
Description copied from class: LuaValue
Convert to human readable String for any type.

Overrides:
tojstring in class LuaValue
Returns:
String for use by human readers based on type.
See Also:
LuaValue.tostring(), LuaValue.optjstring(String), LuaValue.checkjstring(), LuaValue.isstring(), LuaValue.TSTRING

strvalue

public LuaString strvalue()
Description copied from class: LuaValue
Convert this value to a string if it is a LuaString or LuaNumber, or throw a LuaError if it is not

Overrides:
strvalue in class LuaValue
Returns:
LuaString corresponding to the value if a string or number

optstring

public LuaString optstring(LuaString defval)
Description copied from class: LuaValue
Check that optional argument is a string or number and return as LuaString

Overrides:
optstring in class LuaValue
Parameters:
defval - LuaString to return if this is nil or none
Returns:
this converted to LuaString if a string or number, defval if nil or none, throws LuaError if some other type
See Also:
LuaValue.tojstring(), LuaValue.optjstring(String), LuaValue.checkstring(), LuaValue.toString(), LuaValue.TSTRING

tostring

public LuaValue 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, and LuaValue.NIL for all other cases.

This allows values to be tested for their "string-ness" without the penalty of throwing exceptions.

Overrides:
tostring in class LuaValue
Returns:
this if it is a LuaString or LuaNumber, otherwise LuaValue.NIL
See Also:
LuaValue.tonumber(), LuaValue.tojstring(), LuaValue.optstring(LuaString), LuaValue.checkstring(), LuaValue.toString()

optjstring

public java.lang.String optjstring(java.lang.String defval)
Description copied from class: LuaValue
Check that optional argument is a string or number and return as Java String

Overrides:
optjstring in class LuaValue
Parameters:
defval - LuaString to return if this is nil or none
Returns:
this converted to String if a string or number, defval if nil or none, throws LuaError if some other type
See Also:
LuaValue.tojstring(), LuaValue.optstring(LuaString), LuaValue.checkjstring(), LuaValue.toString(), LuaValue.TSTRING

optnumber

public LuaNumber optnumber(LuaNumber defval)
Description copied from class: LuaValue
Check that optional argument is a number or string convertible to number and return as LuaNumber

Overrides:
optnumber in class LuaNumber
Parameters:
defval - LuaNumber to return if this is nil or none
Returns:
this cast to LuaNumber if numeric, defval if nil or none, throws LuaError otherwise
See Also:
LuaValue.optdouble(double), LuaValue.optlong(long), LuaValue.optint(int), LuaValue.checkint(), LuaValue.toint(), LuaValue.tonumber(), LuaValue.isnumber(), LuaValue.TNUMBER

isnumber

public boolean isnumber()
Description copied from class: LuaValue
Check if this is a number

Overrides:
isnumber in class LuaNumber
Returns:
true if this is a number, meaning derives from LuaNumber or derives from LuaString and is convertible to a number, otherwise false
See Also:
LuaValue.tonumber(), LuaValue.checknumber(), LuaValue.optnumber(LuaNumber), LuaValue.TNUMBER

isstring

public boolean isstring()
Description copied from class: LuaValue
Check if this is a string

Overrides:
isstring in class LuaNumber
Returns:
true if this is a string, meaning derives from LuaString or LuaNumber, otherwise false
See Also:
LuaValue.tostring(), LuaValue.checkstring(), LuaValue.optstring(LuaString), LuaValue.TSTRING

tonumber

public LuaValue 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, and LuaValue.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 class LuaNumber
Returns:
this if it is a LuaNumber or LuaString that can be converted to a number, otherwise LuaValue.NIL
See Also:
LuaValue.tostring(), LuaValue.optnumber(LuaNumber), LuaValue.checknumber(), LuaValue.toint(), LuaValue.todouble()

checkint

public int checkint()
Description copied from class: LuaValue
Check that the value is numeric, and convert and cast value to int, or throw 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.

Overrides:
checkint in class LuaValue
Returns:
value cast to a int if numeric
See Also:
LuaValue.checkinteger(), LuaValue.checklong(), LuaValue.checkdouble(), LuaValue.optint(int), LuaValue.TNUMBER

checklong

public long checklong()
Description copied from class: LuaValue
Check that the value is numeric, and convert and cast value to long, or throw 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.

Overrides:
checklong in class LuaValue
Returns:
value cast to a long if numeric
See Also:
LuaValue.checkint(), LuaValue.checkinteger(), LuaValue.checkdouble(), LuaValue.optlong(long), LuaValue.TNUMBER

checknumber

public LuaNumber checknumber()
Description copied from class: LuaValue
Check that the value is numeric, and return as a LuaNumber if so, or throw LuaError

Values that are LuaString that can be converted to a number will be converted and returned.

Overrides:
checknumber in class LuaNumber
Returns:
value as a LuaNumber if numeric
See Also:
LuaValue.checkint(), LuaValue.checkinteger(), LuaValue.checkdouble(), LuaValue.checklong(), LuaValue.optnumber(LuaNumber), LuaValue.TNUMBER

checkdouble

public double checkdouble()
Description copied from class: LuaValue
Check that the value is numeric and return the value as a double, or throw 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.

Overrides:
checkdouble in class LuaValue
Returns:
value cast to a double if numeric
See Also:
LuaValue.checkint(), LuaValue.checkinteger(), LuaValue.checklong(), LuaValue.optdouble(double), LuaValue.TNUMBER

checkjstring

public java.lang.String 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 class LuaValue
Returns:
String representation of the value
See Also:
LuaValue.checkstring(), LuaValue.optjstring(String), LuaValue.tojstring(), LuaValue.isstring(), LuaValue.TSTRING

checkstring

public LuaString checkstring()
Description copied from class: LuaValue
Check that this is a lua string, or throw 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.

Overrides:
checkstring in class LuaValue
Returns:
LuaString representation of the value if it is a LuaString or LuaNumber
See Also:
LuaValue.checkjstring(), LuaValue.optstring(LuaString), LuaValue.tostring(), LuaValue.isstring(), LuaValue.TSTRING

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 class LuaValue
Returns:
true if valid as a table key, otherwise false
See Also:
LuaValue.isnil(), LuaValue.isinttype()


Copyright © 2007-2015 Luaj.org. All Rights Reserved.