public abstract class LuaValue extends Varargs
Establishes base implementations for all the operations on lua types.
This allows Java clients to deal essentially with one type for all Java values, namely LuaValue.
Constructors are provided as static methods for common Java types, such as
valueOf(int) or valueOf(String)
to allow for instance pooling.
Constants are defined for the lua values
NIL, TRUE, and FALSE.
A constant NONE is defined which is a Varargs list having no values.
Operations are performed on values directly via their Java methods. For example, the following code divides two numbers:
LuaValue a = LuaValue.valueOf( 5 );
LuaValue b = LuaValue.valueOf( 4 );
LuaValue c = a.div(b);
Note that in this example, c will be a LuaDouble, but would be a LuaInteger
if the value of a were changed to 8, say.
In general the value of c in practice will vary depending on both the types and values of a and b
as well as any metatable/metatag processing that occurs.
Field access and function calls are similar, with common overloads to simplify Java usage:
LuaValue globals = JsePlatform.standardGlobals();
LuaValue sqrt = globals.get("math").get("sqrt");
LuaValue print = globals.get("print");
LuaValue d = sqrt.call( a );
print.call( LuaValue.valueOf("sqrt(5):"), a );
To supply variable arguments or get multiple return values, use
invoke(Varargs) or invokemethod(LuaValue, Varargs) methods:
LuaValue modf = globals.get("math").get("modf");
Varargs r = modf.invoke( d );
print.call( r.arg(1), r.arg(2) );
To load and run a script, LoadState is used:
LoadState.load( new FileInputStream("main.lua"), "main.lua", globals ).call();
although require could also be used:
globals.get("require").call(LuaValue.valueOf("main"));
For this to work the file must be in the current directory, or in the class path,
dependening on the platform.
In general a LuaError may be thrown on any operation when the
types supplied to any operation are illegal from a lua perspective.
Examples could be attempting to concatenate a NIL value, or attempting arithmetic
on values that are not number.
There are several methods for preinitializing tables, such as:
listOf(LuaValue[]) for unnamed elementstableOf(LuaValue[]) for named elementstableOf(LuaValue[], LuaValue[], Varargs) for mixtures
Predefined constants exist for the standard lua type constants
TNIL, TBOOLEAN, TLIGHTUSERDATA, TNUMBER, TSTRING,
TTABLE, TFUNCTION, TUSERDATA, TTHREAD,
and extended lua type constants
TINT, TNONE, TVALUE
Predefined constants exist for all strings used as metatags:
INDEX, NEWINDEX, CALL, MODE, METATABLE,
ADD, SUB, DIV, MUL, POW,
MOD, UNM, LEN, EQ, LT,
LE, TOSTRING, and CONCAT.
JsePlatform,
LoadState,
Varargs| 限定符和类型 | 字段和说明 |
|---|---|
static LuaString |
ADD
LuaString constant with value "__add" for use as metatag
|
static LuaString |
BAND |
static LuaString |
BNOT |
static LuaString |
BOR |
static LuaString |
BXOR |
static LuaString |
CALL
LuaString constant with value "__call" for use as metatag
|
static LuaString |
CONCAT
LuaString constant with value "__concat" for use as metatag
|
static LuaString |
DIV
LuaString constant with value "__div" for use as metatag
|
static LuaString |
EMPTYSTRING
LuaString constant with value ""
|
static LuaString |
ENV
The variable name of the environment.
|
static LuaString |
EQ
LuaString constant with value "__eq" for use as metatag
|
static LuaBoolean |
FALSE
LuaBoolean constant corresponding to lua
false |
static LuaString |
IDIV |
static LuaString |
INDEX
LuaString constant with value "__index" for use as metatag
|
static LuaString |
LE
LuaString constant with value "__le" for use as metatag
|
static LuaString |
LEN
LuaString constant with value "__len" for use as metatag
|
static LuaString |
LT
LuaString constant with value "__lt" for use as metatag
|
static LuaString |
METATABLE
LuaString constant with value "__metatable" for use as metatag
|
static LuaNumber |
MINUSONE
LuaValue number constant equal to -1
|
static LuaString |
MOD
LuaString constant with value "__mod" for use as metatag
|
static LuaString |
MODE
LuaString constant with value "__mode" for use as metatag
|
static LuaString |
MUL
LuaString constant with value "__mul" for use as metatag
|
static LuaString |
NEWINDEX
LuaString constant with value "__newindex" for use as metatag
|
static LuaValue |
NIL
LuaValue constant corresponding to lua
#NIL |
static LuaValue[] |
NILS
Array of
NIL values to optimize filling stacks using System.arraycopy(). |
static LuaValue |
NONE
LuaValue constant corresponding to a
Varargs list of no values |
static LuaValue[] |
NOVALS
LuaValue array constant with no values
|
static LuaNumber |
ONE
LuaValue number constant equal to 1
|
static LuaString |
POW
LuaString constant with value "__pow" for use as metatag
|
static LuaString |
SHL |
static LuaString |
SHR |
static LuaString |
SUB
LuaString constant with value "__sub" for use as metatag
|
static int |
TBOOLEAN
Type enumeration constant for lua booleans
|
static int |
TFUNCTION
Type enumeration constant for lua functions
|
static int |
TINT
Type enumeration constant for lua numbers that are ints, for compatibility with lua 5.1 number patch only
|
static int |
TLIGHTUSERDATA
Type enumeration constant for lua light userdata, for compatibility with C-based lua only
|
static int |
TNIL
Type enumeration constant for lua nil
|
static int |
TNONE
Type enumeration constant for lua values that have no type, for example weak table entries
|
static int |
TNUMBER
Type enumeration constant for lua numbers
|
static LuaString |
TOSTRING
LuaString constant with value "__tostring" for use as metatag
|
static LuaBoolean |
TRUE
LuaBoolean constant corresponding to lua
true |
static int |
TSTRING
Type enumeration constant for lua strings
|
static int |
TTABLE
Type enumeration constant for lua tables
|
static int |
TTHREAD
Type enumeration constant for lua threads
|
static int |
TUSERDATA
Type enumeration constant for lua userdatas
|
static int |
TVALUE
Type enumeration constant for unknown values, for compatibility with C-based lua only
|
static String[] |
TYPE_NAMES
String array constant containing names of each of the lua value types
|
static LuaString |
UNM
LuaString constant with value "__unm" for use as metatag
|
LuaValue |
uservalue |
static LuaNumber |
ZERO
LuaValue number constant equal to 0
|
| 构造器和说明 |
|---|
LuaValue() |
| 限定符和类型 | 方法和说明 |
|---|---|
LuaValue |
add(double rhs)
|
LuaValue |
add(long rhs)
|
LuaValue |
add(LuaValue rhs)
Add: Perform numeric add operation with another value
including metatag processing.
|
LuaValue |
and(LuaValue rhs)
Perform boolean
and with another operand, based on lua rules for boolean evaluation. |
LuaValue |
arg(int index)
Get the n-th argument value (1-based).
|
LuaValue |
arg1()
Get the first argument in the list.
|
static LuaValue |
argerror(int iarg,
String msg)
Throw a
LuaError indicating an invalid argument was supplied to a function |
protected LuaValue |
argerror(String expected)
Throw a
LuaError indicating an invalid argument was supplied to a function |
protected LuaValue |
aritherror()
Throw a
LuaError based on an arithmetic error such as add, or pow,
typically due to an invalid operand type |
protected LuaValue |
aritherror(String fun)
Throw a
LuaError based on an arithmetic error such as add, or pow,
typically due to an invalid operand type |
protected LuaValue |
arithmt(LuaValue tag,
LuaValue op2)
Perform metatag processing for arithmetic operations.
|
protected LuaValue |
arithmtwith(LuaValue tag,
double op1)
Perform metatag processing for arithmetic operations when the left-hand-side is a number.
|
static void |
assert_(boolean b,
String msg)
Assert a condition is true, or throw a
LuaError if not
Returns no value when b is true, throws error(String) with msg as argument
and does not return if b is false. |
LuaValue |
band(long rhs) |
LuaValue |
band(LuaValue rhs) |
LuaValue |
bnot() |
LuaValue |
bor(long rhs) |
LuaValue |
bor(LuaValue rhs) |
Buffer |
buffer()
Convert the value to a
Buffer for more efficient concatenation of
multiple strings. |
LuaValue |
bxor(long rhs) |
LuaValue |
bxor(LuaValue rhs) |
LuaValue |
call()
Call
this with 0 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
call(LuaValue arg)
Call
this with 1 argument, including metatag processing,
and return only the first return value. |
LuaValue |
call(LuaValue arg1,
LuaValue arg2)
Call
this with 2 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
call(LuaValue arg1,
LuaValue arg2,
LuaValue arg3)
Call
this with 3 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
call(String arg)
Convenience function which calls a luavalue with a single, string argument.
|
protected LuaValue |
callmt()
Get the metatag value for the
CALL metatag, if it exists. |
boolean |
checkboolean()
Check that the value is a
LuaBoolean,
or throw LuaError if not |
LuaClosure |
checkclosure()
Check that the value is a
LuaClosure ,
or throw LuaError if not
LuaClosure is a subclass of LuaFunction that interprets lua bytecode. |
double |
checkdouble()
|
LuaFunction |
checkfunction()
Check that the value is a function , or throw
LuaError if not
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode. |
Globals |
checkglobals()
|
int |
checkint()
|
LuaInteger |
checkinteger()
|
String |
checkjstring()
Convert this value to a Java String.
|
long |
checklong()
|
protected LuaValue |
checkmetatag(LuaValue tag,
String reason)
Get particular metatag, or throw
LuaError if it doesn't exist |
LuaValue |
checknotnil()
|
LuaNumber |
checknumber()
|
LuaNumber |
checknumber(String msg)
|
LuaString |
checkstring()
Check that this is a lua string, or throw
LuaError if it is not. |
LuaTable |
checktable()
|
LuaThread |
checkthread()
|
Object |
checkuserdata()
Check that this is a
LuaUserdata, or throw LuaError if it is not |
Object |
checkuserdata(Class c)
Check that this is a
LuaUserdata, or throw LuaError if it is not |
protected LuaValue |
compareerror(LuaValue rhs)
Throw a
LuaError based on a comparison error such as greater-than or less-than,
typically due to an invalid operand type |
protected LuaValue |
compareerror(String rhs)
Throw a
LuaError based on a comparison error such as greater-than or less-than,
typically due to an invalid operand type |
LuaValue |
comparemt(LuaValue tag,
LuaValue op1)
Perform metatag processing for comparison operations.
|
Buffer |
concat(Buffer rhs)
Concatenate a
Buffer onto this value and return the result
using rules of lua string concatenation including metatag processing. |
LuaValue |
concat(LuaValue rhs)
Concatenate another value onto this value and return the result
using rules of lua string concatenation including metatag processing.
|
LuaValue |
concatmt(LuaValue rhs)
Perform metatag processing for concatenation operations.
|
LuaValue |
concatTo(LuaNumber lhs)
Reverse-concatenation: concatenate this value onto another value
known to be a
LuaNumber
and return the result using rules of lua string concatenation including
metatag processing. |
LuaValue |
concatTo(LuaString lhs)
Reverse-concatenation: concatenate this value onto another value
known to be a
LuaString
and return the result using rules of lua string concatenation including
metatag processing. |
LuaValue |
concatTo(LuaValue lhs)
Reverse-concatenation: concatenate this value onto another value
whose type is unknwon
and return the result using rules of lua string concatenation including
metatag processing.
|
LuaValue |
div(double rhs)
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 div(LuaValue) must be used |
LuaValue |
div(long rhs)
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 div(LuaValue) must be used |
LuaValue |
div(LuaValue rhs)
Divide: Perform numeric divide operation by another value
of unknown type,
including metatag processing.
|
LuaValue |
divInto(double lhs)
|
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. |
static boolean |
eqmtcall(LuaValue lhs,
LuaValue lhsmt,
LuaValue rhs,
LuaValue rhsmt)
Perform equality testing metatag processing
|
boolean |
equals(Object obj) |
static LuaValue |
error(String message)
Throw a
LuaError with a particular message |
LuaValue |
get(int key)
Get a value in a table including metatag processing using
INDEX. |
LuaValue |
get(LuaValue key)
Get a value in a table including metatag processing using
INDEX. |
LuaValue |
get(String key)
Get a value in a table including metatag processing using
INDEX. |
LuaValue |
getfenv() |
LuaValue |
getmetatable()
Get the metatable for this
LuaValue
For LuaTable and LuaUserdata instances,
the metatable returned is this instance metatable. |
protected static LuaValue |
gettable(LuaValue t,
LuaValue key)
get value from metatable operations, or NIL if not defined by metatables
|
LuaValue |
getuservalue() |
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(long 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(long 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(long 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(long 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. |
LuaValue |
idiv(long rhs) |
LuaValue |
idiv(LuaValue rhs) |
protected LuaValue |
illegal(String op,
String typename)
Throw a
LuaError indicating an illegal operation occurred,
typically involved in managing weak references |
Varargs |
inext(LuaValue index)
|
void |
initupvalue1(LuaValue env)
Hook for implementations such as LuaJC to load the environment of the main chunk
into the first upvalue location.
|
Varargs |
invoke()
Call
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invoke(LuaValue[] args)
Call
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invoke(LuaValue[] args,
Varargs varargs)
Call
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invoke(LuaValue arg1,
LuaValue arg2,
Varargs varargs)
Call
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invoke(LuaValue arg,
Varargs varargs)
Call
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invoke(Varargs args)
Call
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(LuaValue name)
Call named method on
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(LuaValue name,
LuaValue[] args)
Call named method on
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(LuaValue name,
Varargs args)
Call named method on
this with variable arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(String name)
Call named method on
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(String name,
LuaValue[] args)
Call named method on
this with 1 argument, including metatag processing,
and retain all return values in a Varargs. |
Varargs |
invokemethod(String name,
Varargs args)
Call named method on
this with 1 argument, including metatag processing,
and retain all return values in a Varargs. |
boolean |
isboolean()
Check if
this is a boolean |
boolean |
isclosure()
Check if
this is a function that is a closure,
meaning interprets lua bytecode for its execution |
boolean |
isfunction()
Check if
this is a function |
boolean |
isint()
Check if
this is a number and is representable by java int
without rounding or truncation |
boolean |
isinttype()
Check if
this is a LuaInteger
No attempt to convert from string will be made by this call. |
boolean |
islong()
Check if
this is a number and is representable by java long
without rounding or truncation |
boolean |
isnil()
Check if
this is #NIL |
boolean |
isnumber()
Check if
this is a number |
boolean |
isstring()
Check if
this is a string |
boolean |
istable()
Check if
this is a table |
boolean |
isthread()
Check if
this is a thread |
boolean |
isuserdata()
Check if
this is a userdata |
boolean |
isuserdata(Class c)
Check if
this is a userdata of type c |
boolean |
isvalidkey()
Return true if this is a valid key in a table index operation.
|
Object |
jcall(Object... args) |
Object |
jget(String key) |
void |
jset(String key,
Object value) |
LuaValue |
len()
Length operator: return lua length of object
(#this) including metatag processing as java int |
protected LuaValue |
lenerror()
Throw a
LuaError based on the len operator,
typically due to an invalid operand type |
int |
length()
Length operator: return lua length of object
(#this) including metatag processing as java int |
static LuaTable |
listOf(LuaValue[] unnamedValues)
Construct a
LuaTable initialized with supplied array values. |
static LuaTable |
listOf(LuaValue[] unnamedValues,
Varargs lastarg)
Construct a
LuaTable initialized with supplied array values. |
LuaValue |
load(LuaValue library)
Load a library instance by calling it with and empty string as the modname,
and this Globals as the environment.
|
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(long 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(long 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(long 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(long 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. |
protected static org.luaj.vm2.Metatable |
metatableOf(LuaValue mt)
Construct a Metatable instance from the given LuaValue
|
LuaValue |
metatag(LuaValue tag)
Get particular metatag, or return
NIL if it doesn't exist |
LuaValue |
method(LuaValue name)
Call named method on
this with 0 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
method(LuaValue name,
LuaValue arg)
Call named method on
this with 1 argument, including metatag processing,
and return only the first return value. |
LuaValue |
method(LuaValue name,
LuaValue arg1,
LuaValue arg2)
Call named method on
this with 2 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
method(String name)
Call named method on
this with 0 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
method(String name,
LuaValue arg)
Call named method on
this with 1 argument, including metatag processing,
and return only the first return value. |
LuaValue |
method(String name,
LuaValue arg1,
LuaValue arg2)
Call named method on
this with 2 arguments, including metatag processing,
and return only the first return value. |
LuaValue |
mod(double rhs)
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 mod(LuaValue) must be used |
LuaValue |
mod(long rhs)
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 mod(LuaValue) must be used |
LuaValue |
mod(LuaValue rhs)
Modulo: Perform numeric modulo operation with another value
of unknown type,
including metatag processing.
|
LuaValue |
modFrom(double lhs)
|
LuaValue |
mul(double rhs)
|
LuaValue |
mul(long rhs)
|
LuaValue |
mul(LuaValue rhs)
Multiply: Perform numeric multiply operation with another value
of unknown type,
including metatag processing.
|
int |
narg()
Get the number of arguments, or 0 if there are none.
|
LuaValue |
neg()
Unary minus: return negative value
(-this) as defined by lua unary minus operator |
boolean |
neq_b(LuaValue val)
Notquals: Perform inequality comparison with another value
including metatag processing using
EQ. |
LuaValue |
neq(LuaValue val)
Notquals: Perform inequality comparison with another value
including metatag processing using
EQ. |
Varargs |
next(LuaValue index)
|
LuaValue |
not()
Unary not: return inverse boolean value
(~this) as defined by lua not operator |
Varargs |
onInvoke(Varargs args)
Callback used during tail call processing to invoke the function once.
|
boolean |
optboolean(boolean defval)
Check that optional argument is a boolean and return its boolean value
|
LuaClosure |
optclosure(LuaClosure defval)
Check that optional argument is a closure and return as
LuaClosure
A LuaClosure is a LuaFunction that executes lua byteccode. |
double |
optdouble(double defval)
Check that optional argument is a number or string convertible to number and return as double
|
LuaFunction |
optfunction(LuaFunction defval)
Check that optional argument is a function and return as
LuaFunction
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode. |
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 |
String |
optjstring(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 |
LuaTable |
opttable(LuaTable defval)
Check that optional argument is a table and return as
LuaTable |
LuaThread |
optthread(LuaThread defval)
Check that optional argument is a thread and return as
LuaThread |
Object |
optuserdata(Class c,
Object defval)
Check that optional argument is a userdata whose instance is of a type
and return the Object instance
|
Object |
optuserdata(Object defval)
Check that optional argument is a userdata and return the Object instance
|
LuaValue |
optvalue(LuaValue defval)
Perform argument check that this is not nil or none.
|
LuaValue |
or(LuaValue rhs)
Perform boolean
or with another operand, based on lua rules for boolean evaluation. |
LuaValue |
pow(double rhs)
|
LuaValue |
pow(long rhs)
|
LuaValue |
pow(LuaValue rhs)
Raise to power: Raise this value to a power
including metatag processing.
|
LuaValue |
powWith(double lhs)
|
LuaValue |
powWith(long lhs)
|
void |
presize(int i)
Preallocate the array part of a table to be a certain size,
Primarily used internally in response to a SETLIST bytecode.
|
boolean |
raweq(double val)
Equals: Perform direct equality comparison with a double value
without metatag processing.
|
boolean |
raweq(long val)
Equals: Perform direct equality comparison with a int value
without metatag processing.
|
boolean |
raweq(LuaString val)
Equals: Perform direct equality comparison with a
LuaString value
without metatag processing. |
boolean |
raweq(LuaUserdata val)
Equals: Perform direct equality comparison with a
LuaUserdata value
without metatag processing. |
boolean |
raweq(LuaValue val)
Equals: Perform direct equality comparison with another value
without metatag processing.
|
LuaValue |
rawget(int key)
Get a value in a table without metatag processing.
|
LuaValue |
rawget(LuaValue key)
Get a value in a table without metatag processing.
|
LuaValue |
rawget(String key)
Get a value in a table without metatag processing.
|
int |
rawlen()
Get raw length of table or string without metatag processing.
|
void |
rawset(int key,
LuaValue value)
Set a value in a table without metatag processing.
|
void |
rawset(int key,
String value)
Set a value in a table without metatag processing.
|
void |
rawset(LuaValue key,
LuaValue value)
Set a value in a table without metatag processing.
|
void |
rawset(String key,
double value)
Set a value in a table without metatag processing.
|
void |
rawset(String key,
int value)
Set a value in a table without metatag processing.
|
void |
rawset(String key,
LuaValue value)
Set a value in a table without metatag processing.
|
void |
rawset(String key,
String value)
Set a value in a table without metatag processing.
|
void |
rawsetlist(int key0,
Varargs values)
Set list values in a table without invoking metatag processing
Primarily used internally in response to a SETLIST bytecode.
|
void |
set(int key,
LuaValue value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(int key,
String value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(LuaValue key,
LuaValue value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(String key,
double value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(String key,
int value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(String key,
LuaValue value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
set(String key,
String value)
Set a value in a table without metatag processing using
NEWINDEX. |
void |
setfenv(LuaValue env) |
LuaValue |
setmetatable(LuaValue metatable)
Set the metatable for this
LuaValue
For LuaTable and LuaUserdata instances, the metatable is per instance. |
protected static boolean |
settable(LuaValue t,
LuaValue key,
LuaValue value)
Perform field assignment including metatag processing.
|
void |
setuservalue(LuaValue uservalue) |
LuaValue |
shl(long rhs) |
LuaValue |
shl(LuaValue rhs) |
LuaValue |
shr(long rhs) |
LuaValue |
shr(LuaValue rhs) |
int |
strcmp(LuaString rhs)
Perform string comparison with another value
known to be a
LuaString
using string comparison based on byte values. |
int |
strcmp(LuaValue rhs)
Perform string comparison with another value
of any type
using string comparison based on byte values.
|
LuaValue |
strongvalue()
Return this value as a strong reference, or null if it was weak and is no longer referenced.
|
LuaString |
strvalue()
|
LuaValue |
sub(double rhs)
|
LuaValue |
sub(long rhs)
|
LuaValue |
sub(LuaValue rhs)
Subtract: Perform numeric subtract operation with another value
of unknown type,
including metatag processing.
|
Varargs |
subargs(int start)
Create a
Varargs instance containing arguments starting at index start |
LuaValue |
subFrom(double lhs)
|
LuaValue |
subFrom(long lhs)
Reverse-subtract: Perform numeric subtract operation from a double value
without metatag processing
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing sub(LuaValue) must be used |
static LuaTable |
tableOf()
Construct an empty
LuaTable. |
static LuaTable |
tableOf(int narray,
int nhash)
Construct an empty
LuaTable preallocated to hold array and hashed elements |
static LuaTable |
tableOf(LuaValue[] namedValues)
Construct a
LuaTable initialized with supplied named values. |
static LuaTable |
tableOf(LuaValue[] namedValues,
LuaValue[] unnamedValues)
Construct a
LuaTable initialized with supplied named values and sequential elements. |
static LuaTable |
tableOf(LuaValue[] namedValues,
LuaValue[] unnamedValues,
Varargs lastarg)
Construct a
LuaTable initialized with supplied named values and sequential elements in an array part and as varargs. |
static LuaTable |
tableOf(Varargs varargs,
int firstarg)
Construct a
LuaTable initialized with supplied array values. |
static Varargs |
tailcallOf(LuaValue func,
Varargs args)
Construct a
TailcallVarargs around a function and arguments. |
boolean |
testfor_b(LuaValue limit,
LuaValue step)
Perform end-condition test in for-loop processing.
|
boolean |
toboolean()
|
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.
|
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.
|
String |
toString()
Convert the value to a human readable string using
tojstring() |
Object |
touserdata()
Convert to userdata instance, or null.
|
<T> T |
touserdata(Class<T> c)
Convert to userdata instance if specific type, or null.
|
abstract int |
type()
Get the enumeration value for the type of this value.
|
abstract String |
typename()
Get the String name of the type of this value.
|
protected LuaValue |
typerror(String expected)
Throw a
LuaError indicating an invalid type was supplied to a function |
protected LuaValue |
unimplemented(String fun)
Throw a
LuaError indicating an operation is not implemented |
static LuaUserdata |
userdataOf(Object o)
Construct a LuaUserdata for an object.
|
static LuaUserdata |
userdataOf(Object o,
LuaValue metatable)
Construct a LuaUserdata for an object with a user supplied metatable.
|
static LuaBoolean |
valueOf(boolean b)
Convert java boolean to a
LuaValue. |
static LuaString |
valueOf(byte[] bytes)
Convert bytes in an array to a
LuaValue. |
static LuaString |
valueOf(byte[] bytes,
int off,
int len)
Convert bytes in an array to a
LuaValue. |
static LuaNumber |
valueOf(double d)
Convert java double to a
LuaValue. |
static LuaInteger |
valueOf(int i)
Convert java int to a
LuaValue. |
static LuaNumber |
valueOf(long i) |
static LuaString |
valueOf(String s)
Convert java string to a
LuaValue. |
static Varargs |
varargsOf(LuaValue[] v)
|
static Varargs |
varargsOf(LuaValue[] v,
int offset,
int length)
|
static Varargs |
varargsOf(LuaValue[] v,
int offset,
int length,
Varargs more)
|
static Varargs |
varargsOf(LuaValue[] v,
Varargs r)
|
static Varargs |
varargsOf(LuaValue v1,
LuaValue v2,
Varargs v3)
|
static Varargs |
varargsOf(LuaValue v,
Varargs r)
|
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkinteger, checkjstring, checklong, checknotnil, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, checkvalue, dealias, eval, isfunction, isnil, isnoneornil, isnumber, isstring, istable, isTailcall, isthread, isuserdata, isvalue, optboolean, optclosure, optdouble, optfunction, optint, optinteger, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tolong, toshort, touserdata, touserdata, typepublic static final int TINT
public static final int TNONE
public static final int TNIL
public static final int TBOOLEAN
public static final int TLIGHTUSERDATA
public static final int TNUMBER
public static final int TSTRING
public static final int TTABLE
public static final int TFUNCTION
public static final int TUSERDATA
public static final int TTHREAD
public static final int TVALUE
public static final String[] TYPE_NAMES
type(),
typename()public static final LuaValue NIL
#NILpublic static final LuaBoolean TRUE
truepublic static final LuaBoolean FALSE
falsepublic static final LuaValue NONE
Varargs list of no valuespublic static final LuaNumber ZERO
public static final LuaNumber ONE
public static final LuaNumber MINUSONE
public static final LuaValue[] NOVALS
public static LuaString ENV
public static final LuaString INDEX
public static final LuaString NEWINDEX
public static final LuaString CALL
public static final LuaString MODE
public static final LuaString METATABLE
public static final LuaString ADD
public static final LuaString SUB
public static final LuaString DIV
public static final LuaString MUL
public static final LuaString POW
public static final LuaString MOD
public static final LuaString UNM
public static final LuaString LEN
public static final LuaString EQ
public static final LuaString LT
public static final LuaString LE
public static final LuaString TOSTRING
public static final LuaString CONCAT
public static final LuaString EMPTYSTRING
public static final LuaValue[] NILS
NIL values to optimize filling stacks using System.arraycopy().
Must not be modified.public LuaValue uservalue
public static final LuaString IDIV
public static final LuaString BAND
public static final LuaString BOR
public static final LuaString BXOR
public static final LuaString SHL
public static final LuaString SHR
public static final LuaString BNOT
public abstract int type()
public abstract String typename()
TYPE_NAMES
corresponding to the type of this value:
"nil", "boolean", "number", "string",
"table", "function", "userdata", "thread"type()public boolean isboolean()
this is a booleanboolean, otherwise falseisboolean(),
toboolean(),
checkboolean(),
optboolean(boolean),
TBOOLEANpublic boolean isclosure()
this is a function that is a closure,
meaning interprets lua bytecode for its executionclosure, otherwise falseisfunction(),
checkclosure(),
optclosure(LuaClosure),
TFUNCTIONpublic boolean isfunction()
this is a functionfunction, otherwise falseisclosure(),
checkfunction(),
optfunction(LuaFunction),
TFUNCTIONpublic boolean isint()
this is a number and is representable by java int
without rounding or truncationnumber
meaning derives from LuaNumber
or derives from LuaString and is convertible to a number,
and can be represented by int,
otherwise falseisinttype(),
islong(),
tonumber(),
checkint(),
optint(int),
TNUMBERpublic boolean isinttype()
LuaInteger,
otherwise falseisint(),
isnumber(),
tonumber(),
TNUMBERpublic boolean islong()
this is a number and is representable by java long
without rounding or truncationnumber
meaning derives from LuaNumber
or derives from LuaString and is convertible to a number,
and can be represented by long,
otherwise falsetonumber(),
checklong(),
optlong(long),
TNUMBERpublic boolean isnil()
this is #NIL#NIL, otherwise falseNIL,
NONE,
checknotnil(),
optvalue(LuaValue),
Varargs.isnoneornil(int),
TNIL,
TNONEpublic boolean isnumber()
this is a numbernumber,
meaning derives from LuaNumber
or derives from LuaString and is convertible to a number,
otherwise falsetonumber(),
checknumber(),
optnumber(LuaNumber),
TNUMBERpublic boolean isstring()
this is a stringstring,
meaning derives from LuaString or LuaNumber,
otherwise falsetostring(),
checkstring(),
optstring(LuaString),
TSTRINGpublic boolean isthread()
this is a threadthread, otherwise falsecheckthread(),
optthread(LuaThread),
TTHREADpublic boolean istable()
this is a tabletable, otherwise falsechecktable(),
opttable(LuaTable),
TTABLEpublic boolean isuserdata()
this is a userdatauserdata, otherwise falseisuserdata(Class),
touserdata(),
checkuserdata(),
optuserdata(Object),
TUSERDATApublic boolean isuserdata(Class c)
this is a userdata of type cc - Class to test instance againstuserdata
and the instance is assignable to c,
otherwise falseisuserdata(),
touserdata(Class),
checkuserdata(Class),
optuserdata(Class, Object),
TUSERDATApublic boolean toboolean()
optboolean(boolean),
checkboolean(),
isboolean(),
TBOOLEANpublic byte tobyte()
toint(),
todouble(),
checknumber(),
isnumber(),
TNUMBERpublic char tochar()
toint(),
todouble(),
checknumber(),
isnumber(),
TNUMBERpublic double todouble()
toint(),
tobyte(),
tochar(),
toshort(),
tolong(),
tofloat(),
optdouble(double),
checknumber(),
isnumber(),
TNUMBERpublic float tofloat()
toint(),
todouble(),
checknumber(),
isnumber(),
TNUMBERpublic int toint()
tobyte(),
tochar(),
toshort(),
tolong(),
tofloat(),
todouble(),
optint(int),
checknumber(),
isnumber(),
TNUMBERpublic long tolong()
isint(),
isinttype(),
toint(),
todouble(),
optlong(long),
checknumber(),
isnumber(),
TNUMBERpublic short toshort()
toint(),
todouble(),
checknumber(),
isnumber(),
TNUMBERpublic String tojstring()
tojstring 在类中 Varargstostring(),
optjstring(String),
checkjstring(),
isstring(),
TSTRINGpublic Object touserdata()
LuaUserdataoptuserdata(Object),
checkuserdata(),
isuserdata(),
TUSERDATApublic <T> T touserdata(Class<T> c)
c,
or null if not LuaUserdataoptuserdata(Class,Object),
checkuserdata(Class),
isuserdata(Class),
TUSERDATApublic String toString()
tojstring()toString 在类中 Varargstostring(),
tojstring(),
optstring(LuaString),
checkstring(),
toString()public LuaValue tonumber()
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.
this if it is a LuaNumber
or LuaString that can be converted to a number,
otherwise NILtostring(),
optnumber(LuaNumber),
checknumber(),
toint(),
todouble()public LuaValue tostring()
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.
this if it is a LuaString or LuaNumber,
otherwise NILtonumber(),
tojstring(),
optstring(LuaString),
checkstring(),
toString()public boolean optboolean(boolean defval)
defval - boolean value to return if this is nil or nonethis cast to boolean if a LuaBoolean,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not a boolean or nil or none.checkboolean(),
isboolean(),
TBOOLEANpublic LuaClosure optclosure(LuaClosure defval)
LuaClosure
A LuaClosure is a LuaFunction that executes lua byteccode.
defval - LuaClosure to return if this is nil or nonethis cast to LuaClosure if a function,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not a closure or nil or none.checkclosure(),
isclosure(),
TFUNCTIONpublic double optdouble(double defval)
defval - double to return if this is nil or nonethis cast to double if numeric,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not numeric or nil or none.optint(int),
optinteger(LuaInteger),
checkdouble(),
todouble(),
tonumber(),
isnumber(),
TNUMBERpublic LuaFunction optfunction(LuaFunction defval)
LuaFunction
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode.
defval - LuaFunction to return if this is nil or nonethis cast to LuaFunction if a function,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not a function or nil or none.checkfunction(),
isfunction(),
TFUNCTIONpublic int optint(int defval)
defval - int to return if this is nil or nonethis cast to int if numeric,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not numeric or nil or none.optdouble(double),
optlong(long),
optinteger(LuaInteger),
checkint(),
toint(),
tonumber(),
isnumber(),
TNUMBERpublic LuaInteger optinteger(LuaInteger defval)
LuaIntegerdefval - LuaInteger to return if this is nil or nonethis converted and wrapped in LuaInteger if numeric,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not numeric or nil or none.optdouble(double),
optint(int),
checkint(),
toint(),
tonumber(),
isnumber(),
TNUMBERpublic long optlong(long defval)
defval - long to return if this is nil or nonethis cast to long if numeric,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not numeric or nil or none.optdouble(double),
optint(int),
checkint(),
toint(),
tonumber(),
isnumber(),
TNUMBERpublic LuaNumber optnumber(LuaNumber defval)
LuaNumberdefval - LuaNumber to return if this is nil or nonethis cast to LuaNumber if numeric,
defval if nil or none,
throws LuaError otherwiseLuaError - if was not numeric or nil or none.optdouble(double),
optlong(long),
optint(int),
checkint(),
toint(),
tonumber(),
isnumber(),
TNUMBERpublic String optjstring(String defval)
defval - LuaString to return if this is nil or nonethis converted to String if a string or number,
defval if nil or none,
throws LuaError if some other typeLuaError - if was not a string or number or nil or none.tojstring(),
optstring(LuaString),
checkjstring(),
toString(),
TSTRINGpublic LuaString optstring(LuaString defval)
LuaStringdefval - LuaString to return if this is nil or nonethis converted to LuaString if a string or number,
defval if nil or none,
throws LuaError if some other typeLuaError - if was not a string or number or nil or none.tojstring(),
optjstring(String),
checkstring(),
toString(),
TSTRINGpublic LuaTable opttable(LuaTable defval)
LuaTablepublic LuaThread optthread(LuaThread defval)
LuaThreaddefval - LuaThread to return if this is nil or nonethis cast to LuaTable if a thread,
defval if nil or none,
throws LuaError if some other typeLuaError - if was not a thread or nil or none.checkthread(),
isthread(),
TTHREADpublic Object optuserdata(Object defval)
defval - Object to return if this is nil or noneLuaUserdata,
defval if nil or none,
throws LuaError if some other typeLuaError - if was not a userdata or nil or none.checkuserdata(),
isuserdata(),
optuserdata(Class, Object),
TUSERDATApublic Object optuserdata(Class c, Object defval)
c - Class to test userdata instance againstdefval - Object to return if this is nil or noneLuaUserdata and instance is assignable to c,
defval if nil or none,
throws LuaError if some other typeLuaError - if was not a userdata whose instance is assignable to c or nil or none.checkuserdata(Class),
isuserdata(Class),
optuserdata(Object),
TUSERDATApublic LuaValue optvalue(LuaValue defval)
public boolean checkboolean()
LuaBoolean,
or throw LuaError if notthis if it is a LuaBooleanLuaError - if not a LuaBooleanoptboolean(boolean),
TBOOLEANpublic LuaClosure checkclosure()
LuaClosure ,
or throw LuaError if not
LuaClosure is a subclass of LuaFunction that interprets lua bytecode.
this cast as LuaClosureLuaError - if not a LuaClosurecheckfunction(),
optclosure(LuaClosure),
isclosure(),
TFUNCTIONpublic double checkdouble()
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.
LuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckint(),
checkinteger(),
checklong(),
optdouble(double),
TNUMBERpublic LuaFunction checkfunction()
LuaError if not
A LuaFunction may either be a Java function that implements
functionality directly in Java, or a LuaClosure
which is a LuaFunction that executes lua bytecode.
this if it is a lua function or closureLuaError - if not a functioncheckclosure()public Globals checkglobals()
public int checkint()
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.
LuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckinteger(),
checklong(),
checkdouble(),
optint(int),
TNUMBERpublic LuaInteger checkinteger()
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.
LuaInteger if numericLuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckint(),
checklong(),
checkdouble(),
optinteger(LuaInteger),
TNUMBERpublic long checklong()
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.
LuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckint(),
checkinteger(),
checkdouble(),
optlong(long),
TNUMBERpublic LuaNumber checknumber()
LuaError
Values that are LuaString that can be converted to a number will be converted and returned.
LuaNumber if numericLuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckint(),
checkinteger(),
checkdouble(),
checklong(),
optnumber(LuaNumber),
TNUMBERpublic LuaNumber checknumber(String msg)
LuaError
Values that are LuaString that can be converted to a number will be converted and returned.
msg - String message to supply if conversion failsLuaNumber if numericLuaError - if not a LuaNumber or is a LuaString that can't be converted to numbercheckint(),
checkinteger(),
checkdouble(),
checklong(),
optnumber(LuaNumber),
TNUMBERpublic String checkjstring()
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.
checkstring(),
optjstring(String),
tojstring(),
isstring(),
TSTRINGpublic LuaString checkstring()
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.
LuaString representation of the value if it is a LuaString or LuaNumberLuaError - if this is not a LuaTablecheckjstring(),
optstring(LuaString),
tostring(),
isstring(),
TSTRINGpublic LuaTable checktable()
public LuaThread checkthread()
this if it is a LuaThreadLuaError - if this is not a LuaThreadisthread(),
optthread(LuaThread),
TTHREADpublic Object checkuserdata()
LuaUserdata, or throw LuaError if it is notthis if it is a LuaUserdataLuaError - if this is not a LuaUserdataisuserdata(),
optuserdata(Object),
checkuserdata(Class),
TUSERDATApublic Object checkuserdata(Class c)
LuaUserdata, or throw LuaError if it is notthis if it is a LuaUserdataLuaError - if this is not a LuaUserdataisuserdata(Class),
optuserdata(Class, Object),
checkuserdata(),
TUSERDATApublic LuaValue checknotnil()
this if it is not NILLuaError - if this is NILoptvalue(LuaValue)public boolean isvalidkey()
isnil(),
isinttype()public static LuaValue error(String message)
LuaError with a particular messagemessage - String providing message detailsLuaError - in all casespublic static void assert_(boolean b,
String msg)
LuaError if not
Returns no value when b is true, throws error(String) with msg as argument
and does not return if b is false.b - condition to testmsg - String message to produce on failureLuaError - if b is not trueprotected LuaValue argerror(String expected)
LuaError indicating an invalid argument was supplied to a functionexpected - String naming the type that was expectedLuaError - in all casespublic static LuaValue argerror(int iarg, String msg)
LuaError indicating an invalid argument was supplied to a functioniarg - index of the argument that was invalid, first index is 1msg - String providing information about the invalid argumentLuaError - in all casesprotected LuaValue typerror(String expected)
LuaError indicating an invalid type was supplied to a functionexpected - String naming the type that was expectedLuaError - in all casesprotected LuaValue unimplemented(String fun)
LuaError indicating an operation is not implementedLuaError - in all casesprotected LuaValue illegal(String op, String typename)
LuaError indicating an illegal operation occurred,
typically involved in managing weak referencesLuaError - in all casesprotected LuaValue lenerror()
LuaError based on the len operator,
typically due to an invalid operand typeLuaError - in all casesprotected LuaValue aritherror()
LuaError based on an arithmetic error such as add, or pow,
typically due to an invalid operand typeLuaError - in all casesprotected LuaValue aritherror(String fun)
LuaError based on an arithmetic error such as add, or pow,
typically due to an invalid operand typefun - String description of the function that was attemptedLuaError - in all casesprotected LuaValue compareerror(String rhs)
LuaError based on a comparison error such as greater-than or less-than,
typically due to an invalid operand typerhs - String description of what was on the right-hand-side of the comparison that resulted in the error.LuaError - in all casesprotected LuaValue compareerror(LuaValue rhs)
LuaError based on a comparison error such as greater-than or less-than,
typically due to an invalid operand typerhs - Right-hand-side of the comparison that resulted in the error.LuaError - in all casespublic LuaValue get(LuaValue key)
INDEX.key - the key to look up, must not be NIL or nullLuaValue for that key, or NIL if not found and no metatagLuaError - if this is not a table,
or there is no INDEX metatag,
or key is NILget(int),
get(String),
rawget(LuaValue)public LuaValue get(int key)
INDEX.key - the key to look upLuaValue for that key, or NIL if not foundLuaError - if this is not a table,
or there is no INDEX metatagget(LuaValue),
rawget(int)public LuaValue get(String key)
INDEX.key - the key to look up, must not be nullLuaValue for that key, or NIL if not foundLuaError - if this is not a table,
or there is no INDEX metatagget(LuaValue),
rawget(String)public void set(LuaValue key, LuaValue value)
NEWINDEX.public void set(int key,
LuaValue value)
NEWINDEX.public void set(int key,
String value)
NEWINDEX.public void set(String key, LuaValue value)
NEWINDEX.public void set(String key, double value)
NEWINDEX.public void set(String key, int value)
NEWINDEX.public void set(String key, String value)
NEWINDEX.public LuaValue rawget(int key)
public void rawset(LuaValue key, LuaValue value)
public void rawset(int key,
LuaValue value)
public void rawset(int key,
String value)
public void rawset(String key, LuaValue value)
public void rawset(String key, double value)
key - the key to use, must not be nullvalue - the value to useLuaError - if this is not a tablepublic void rawset(String key, int value)
key - the key to use, must not be nullvalue - the value to useLuaError - if this is not a tablepublic void rawset(String key, String value)
key - the key to use, must not be nullvalue - the value to use, must not be nullLuaError - if this is not a tablepublic void rawsetlist(int key0,
Varargs values)
Primarily used internally in response to a SETLIST bytecode.
key0 - the first key to set in the tablevalues - the list of values to setLuaError - if this is not a table.public void presize(int i)
Primarily used internally in response to a SETLIST bytecode.
i - the number of array slots to preallocate in the table.LuaError - if this is not a table.public Varargs next(LuaValue index)
this is a table,
return NIL if there are no more, or throw a LuaError if not a table.
To iterate over all key-value pairs in a table you can use
LuaValue k = LuaValue.NIL;
while ( true ) {
Varargs n = table.next(k);
if ( (k = n.arg1()).isnil() )
break;
LuaValue v = n.arg(2)
process( k, v )
}index - LuaInteger value identifying a key to start from,
or NIL to start at the beginningVarargs containing {key,value} for the next entry,
or NIL if there are no more.LuaError - if this is not a table, or the supplied key is invalid.LuaTable,
inext(LuaValue),
valueOf(int),
Varargs.arg1(),
Varargs.arg(int),
isnil()public Varargs inext(LuaValue index)
this is a table,
return NIL if there are no more, or throw a LuaError if not a table.
To iterate over integer keys in a table you can use
LuaValue k = LuaValue.NIL;
while ( true ) {
Varargs n = table.inext(k);
if ( (k = n.arg1()).isnil() )
break;
LuaValue v = n.arg(2)
process( k, v )
}
index - LuaInteger value identifying a key to start from,
or NIL to start at the beginningVarargs containing (key,value) for the next entry,
or NONE if there are no more.LuaError - if this is not a table, or the supplied key is invalid.LuaTable,
next(LuaValue),
valueOf(int),
Varargs.arg1(),
Varargs.arg(int),
isnil()public LuaValue load(LuaValue library)
public LuaValue arg(int index)
Varargsarg 在类中 Varargsindex - the index of the argument to get, 1 is the first argumentVarargs.arg1(),
NILpublic int narg()
Varargspublic LuaValue arg1()
Varargsarg1 在类中 VarargsVarargs.arg(int),
NILpublic LuaValue getmetatable()
LuaValue
For LuaTable and LuaUserdata instances,
the metatable returned is this instance metatable.
For all other types, the class metatable value will be returned.
LuaBoolean.s_metatable,
LuaNumber.s_metatable,
LuaNil.s_metatable,
LuaFunction.s_metatable,
LuaThread.s_metatablepublic LuaValue setmetatable(LuaValue metatable)
LuaValue
For LuaTable and LuaUserdata instances, the metatable is per instance.
For all other types, there is one metatable per type that can be set directly from java
metatable - LuaValue instance to serve as the metatable, or null to reset it.this to allow chaining of Java function callsLuaBoolean.s_metatable,
LuaNumber.s_metatable,
LuaNil.s_metatable,
LuaFunction.s_metatable,
LuaThread.s_metatablepublic LuaValue call()
this with 0 arguments, including metatag processing,
and return only the first return value.
If this is a LuaFunction, call it,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a method call, use method(LuaValue) instead.
(this()), or NIL if there were none.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(LuaValue),
call(LuaValue,LuaValue),
call(LuaValue, LuaValue, LuaValue),
invoke(),
method(String),
method(LuaValue)public LuaValue call(LuaValue arg)
this with 1 argument, including metatag processing,
and return only the first return value.
If this is a LuaFunction, call it,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a method call, use method(LuaValue) instead.
arg - First argument to supply to the called function(this(arg)), or NIL if there were none.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
call(LuaValue,LuaValue),
call(LuaValue, LuaValue, LuaValue),
invoke(Varargs),
method(String,LuaValue),
method(LuaValue,LuaValue)public LuaValue call(String arg)
arg - String argument to the function. This will be converted to a LuaString.call(LuaValue)public LuaValue call(LuaValue arg1, LuaValue arg2)
this with 2 arguments, including metatag processing,
and return only the first return value.
If this is a LuaFunction, call it,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a method call, use method(LuaValue) instead.
arg1 - First argument to supply to the called functionarg2 - Second argument to supply to the called function(this(arg1,arg2)), or NIL if there were none.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
call(LuaValue),
call(LuaValue, LuaValue, LuaValue),
invoke(LuaValue, Varargs),
method(String,LuaValue,LuaValue),
method(LuaValue,LuaValue,LuaValue)public LuaValue call(LuaValue arg1, LuaValue arg2, LuaValue arg3)
this with 3 arguments, including metatag processing,
and return only the first return value.
If this is a LuaFunction, call it,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a method call, use method(LuaValue) instead.
arg1 - First argument to supply to the called functionarg2 - Second argument to supply to the called functionarg3 - Second argument to supply to the called function(this(arg1,arg2,arg3)), or NIL if there were none.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
call(LuaValue),
call(LuaValue, LuaValue),
invoke(LuaValue, LuaValue, Varargs),
invokemethod(String,Varargs),
invokemethod(LuaValue,Varargs)public LuaValue method(String name)
this with 0 arguments, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument.
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call() instead.
name - Name of the method to look up for invocationthis:name() as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(),
method(LuaValue),
method(String,LuaValue),
method(String,LuaValue,LuaValue)public LuaValue method(LuaValue name)
this with 0 arguments, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call() instead.
name - Name of the method to look up for invocationthis:name() as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(),
method(String),
method(LuaValue,LuaValue),
method(LuaValue,LuaValue,LuaValue)public LuaValue method(String name, LuaValue arg)
this with 1 argument, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call(LuaValue) instead.
name - Name of the method to look up for invocationarg - Argument to supply to the methodthis:name(arg) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(LuaValue),
invoke(Varargs),
method(String),
method(LuaValue),
method(String,LuaValue,LuaValue)public LuaValue method(LuaValue name, LuaValue arg)
this with 1 argument, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call(LuaValue) instead.
name - Name of the method to look up for invocationarg - Argument to supply to the methodthis:name(arg) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(LuaValue),
invoke(Varargs),
method(String,LuaValue),
method(LuaValue),
method(LuaValue,LuaValue,LuaValue)public LuaValue method(String name, LuaValue arg1, LuaValue arg2)
this with 2 arguments, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call(LuaValue,LuaValue) instead.
name - Name of the method to look up for invocationarg1 - First argument to supply to the methodarg2 - Second argument to supply to the methodthis:name(arg1,arg2) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(LuaValue,LuaValue),
invoke(LuaValue,Varargs),
method(String,LuaValue),
method(LuaValue,LuaValue,LuaValue)public LuaValue method(LuaValue name, LuaValue arg1, LuaValue arg2)
this with 2 arguments, including metatag processing,
and return only the first return value.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return only its first return value, dropping any others.
Otherwise, look for the CALL metatag and call that.
If the return value is a Varargs, only the 1st value will be returned.
To get multiple values, use invoke() instead.
To call this as a plain call, use call(LuaValue,LuaValue) instead.
name - Name of the method to look up for invocationarg1 - First argument to supply to the methodarg2 - Second argument to supply to the methodthis:name(arg1,arg2) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(LuaValue,LuaValue),
invoke(LuaValue,Varargs),
method(LuaValue,LuaValue),
method(String,LuaValue,LuaValue)public Varargs invoke()
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue) instead.
Varargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(Varargs),
invokemethod(String),
invokemethod(LuaValue)public Varargs invoke(Varargs args)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue) instead.
args - Varargs containing the arguments to supply to the called functionVarargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorvarargsOf(LuaValue[]),
call(LuaValue),
invoke(),
invoke(LuaValue,Varargs),
invokemethod(String,Varargs),
invokemethod(LuaValue,Varargs)public Varargs invoke(LuaValue arg, Varargs varargs)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue,Varargs) instead.
arg - The first argument to supply to the called functionvarargs - Varargs containing the remaining arguments to supply to the called functionVarargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorvarargsOf(LuaValue[]),
call(LuaValue,LuaValue),
invoke(LuaValue,Varargs),
invokemethod(String,Varargs),
invokemethod(LuaValue,Varargs)public Varargs invoke(LuaValue arg1, LuaValue arg2, Varargs varargs)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue,Varargs) instead.
arg1 - The first argument to supply to the called functionarg2 - The second argument to supply to the called functionvarargs - Varargs containing the remaining arguments to supply to the called functionVarargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorvarargsOf(LuaValue[]),
call(LuaValue,LuaValue,LuaValue),
invoke(LuaValue,LuaValue,Varargs),
invokemethod(String,Varargs),
invokemethod(LuaValue,Varargs)public Varargs invoke(LuaValue[] args)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue,Varargs) instead.
args - Array of arguments to supply to the called functionVarargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorvarargsOf(LuaValue[]),
call(LuaValue,LuaValue,LuaValue),
invoke(LuaValue,LuaValue,Varargs),
invokemethod(String,LuaValue[]),
invokemethod(LuaValue,LuaValue[])public Varargs invoke(LuaValue[] args, Varargs varargs)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
If this is a LuaFunction, call it, and return all values.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a method call, use invokemethod(LuaValue,Varargs) instead.
args - Array of arguments to supply to the called functionvarargs - Varargs containing additional arguments to supply to the called functionVarargs instance.LuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorvarargsOf(LuaValue[]),
call(LuaValue,LuaValue,LuaValue),
invoke(LuaValue,LuaValue,Varargs),
invokemethod(String,LuaValue[]),
invokemethod(LuaValue,LuaValue[]),
invokemethod(String,Varargs),
invokemethod(LuaValue,Varargs)public Varargs invokemethod(String name)
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke() instead.
name - Name of the method to look up for invocationthis:name() as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(),
method(String),
invokemethod(LuaValue),
invokemethod(String, LuaValue[]),
invokemethod(String, Varargs),
invokemethod(LuaValue, LuaValue[]),
invokemethod(LuaValue, Varargs)public Varargs invokemethod(LuaValue name)
this with 0 arguments, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke() instead.
name - Name of the method to look up for invocationthis:name() as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(),
method(LuaValue),
invokemethod(String),
invokemethod(String, LuaValue[]),
invokemethod(String, Varargs),
invokemethod(LuaValue, LuaValue[]),
invokemethod(LuaValue, Varargs)public Varargs invokemethod(String name, Varargs args)
this with 1 argument, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke(Varargs) instead.
name - Name of the method to look up for invocationargs - Varargs containing arguments to supply to the called function after thisthis:name(args) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(Varargs),
method(String),
invokemethod(String),
invokemethod(LuaValue),
invokemethod(String, LuaValue[]),
invokemethod(LuaValue, LuaValue[]),
invokemethod(LuaValue, Varargs)public Varargs invokemethod(LuaValue name, Varargs args)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke(Varargs) instead.
name - Name of the method to look up for invocationargs - Varargs containing arguments to supply to the called function after thisthis:name(args) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(Varargs),
method(String),
invokemethod(String),
invokemethod(LuaValue),
invokemethod(String, LuaValue[]),
invokemethod(String, Varargs),
invokemethod(LuaValue, LuaValue[])public Varargs invokemethod(String name, LuaValue[] args)
this with 1 argument, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke(Varargs) instead.
name - Name of the method to look up for invocationargs - Array of LuaValue containing arguments to supply to the called function after thisthis:name(args) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(Varargs),
method(String),
invokemethod(String),
invokemethod(LuaValue),
invokemethod(String, Varargs),
invokemethod(LuaValue, LuaValue[]),
invokemethod(LuaValue, Varargs),
varargsOf(LuaValue[])public Varargs invokemethod(LuaValue name, LuaValue[] args)
this with variable arguments, including metatag processing,
and retain all return values in a Varargs.
Look up this[name] and if it is a LuaFunction,
call it inserting this as an additional first argument,
and return all return values as a Varargs instance.
Otherwise, look for the CALL metatag and call that.
To get a particular return value, us Varargs.arg(int)
To call this as a plain call, use invoke(Varargs) instead.
name - Name of the method to look up for invocationargs - Array of LuaValue containing arguments to supply to the called function after thisthis:name(args) as a Varargs instanceLuaError - if not a function and CALL is not defined,
or the invoked function throws a LuaError
or the invoked closure throw a lua errorcall(),
invoke(Varargs),
method(String),
invokemethod(String),
invokemethod(LuaValue),
invokemethod(String, LuaValue[]),
invokemethod(String, Varargs),
invokemethod(LuaValue, Varargs),
varargsOf(LuaValue[])public LuaValue not()
(~this) as defined by lua not operatorpublic LuaValue neg()
(-this) as defined by lua unary minus operatorLuaBoolean if boolean or nil,
numeric inverse as LuaNumber if numeric,
or metatag processing result if UNM metatag is definedLuaError - if this is not a table or string, and has no UNM metatagpublic LuaValue len()
(#this) including metatag processing as java intpublic int length()
(#this) including metatag processing as java intpublic int rawlen()
LuaError - if this is not a table or string.public LuaValue eq(LuaValue val)
EQ.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.eq_b(LuaValue),
raweq(LuaValue),
neq(LuaValue),
eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue),
EQpublic boolean eq_b(LuaValue val)
EQ,
and return java booleanval - The value to compare with.(this == rhs),
false if comparable but not equal,
result converted to java boolean if metatag processing occurs.eq(LuaValue),
raweq(LuaValue),
neq_b(LuaValue),
eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue),
EQpublic LuaValue neq(LuaValue val)
EQ.val - The value to compare with.TRUE if values are comparable and (this != rhs),
FALSE if comparable but equal,
inverse of LuaValue converted to LuaBoolean if metatag processing occurs.eq(LuaValue),
raweq(LuaValue),
eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue),
EQpublic boolean neq_b(LuaValue val)
EQ.val - The value to compare with.(this != rhs),
false if comparable but equal,
inverse of result converted to boolean if metatag processing occurs.eq_b(LuaValue),
raweq(LuaValue),
eqmtcall(LuaValue, LuaValue, LuaValue, LuaValue),
EQpublic boolean raweq(LuaValue val)
val - The value to compare with.(this == rhs), false otherwiseeq(LuaValue),
raweq(LuaUserdata),
raweq(LuaString),
raweq(double),
#raweq(int),
EQpublic boolean raweq(LuaUserdata val)
LuaUserdata value
without metatag processing.val - The LuaUserdata to compare with.this is userdata
and their metatables are the same using ==
and their instances are equal using equals(Object),
otherwise falseeq(LuaValue),
raweq(LuaValue)public boolean raweq(LuaString val)
LuaString value
without metatag processing.public boolean raweq(double val)
val - The double value to compare with.this is a LuaNumber
whose value equals val,
otherwise falsepublic boolean raweq(long val)
val - The double value to compare with.this is a LuaNumber
whose value equals val,
otherwise falsepublic static final boolean eqmtcall(LuaValue lhs, LuaValue lhsmt, LuaValue rhs, LuaValue rhsmt)
lhs - left-hand-side of equality expressionlhsmt - metatag value for left-hand-siderhs - right-hand-side of equality expressionrhsmt - metatag value for right-hand-sideNIL or FALSELuaError - if metatag was not defined for either operandequals(Object),
eq(LuaValue),
raweq(LuaValue),
EQpublic LuaValue add(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the add with(this + rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the ADD metatag definedarithmt(LuaValue, LuaValue)public LuaValue add(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the add with(this + rhs) if this is numericLuaError - if this is not a number or string convertible to numberadd(LuaValue)public LuaValue add(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the add with(this + rhs) if this is numericLuaError - if this is not a number or string convertible to numberadd(LuaValue)public LuaValue sub(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the subtract with(this - rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the SUB metatag definedarithmt(LuaValue, LuaValue)public LuaValue sub(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the subtract with(this - rhs) if this is numericLuaError - if this is not a number or string convertible to numbersub(LuaValue)public LuaValue sub(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the subtract with(this - rhs) if this is numericLuaError - if this is not a number or string convertible to numbersub(LuaValue)public LuaValue subFrom(double lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
lhs - The left-hand-side value from which to perform the subtraction(lhs - this) if this is numericLuaError - if this is not a number or string convertible to numbersub(LuaValue),
sub(double),
#sub(int)public LuaValue subFrom(long lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing sub(LuaValue) must be used
lhs - The left-hand-side value from which to perform the subtraction(lhs - this) if this is numericLuaError - if this is not a number or string convertible to numbersub(LuaValue),
sub(double),
#sub(int)public LuaValue mul(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the multiply with(this * rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the MUL metatag definedarithmt(LuaValue, LuaValue)public LuaValue mul(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the multiply with(this * rhs) if this is numericLuaError - if this is not a number or string convertible to numbermul(LuaValue)public LuaValue mul(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the multiply with(this * rhs) if this is numericLuaError - if this is not a number or string convertible to numbermul(LuaValue)public LuaValue pow(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The power to raise this value to(this ^ rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the POW metatag definedarithmt(LuaValue, LuaValue)public LuaValue pow(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The power to raise this value to(this ^ rhs) if this is numericLuaError - if this is not a number or string convertible to numberpow(LuaValue)public LuaValue pow(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The power to raise this value to(this ^ rhs) if this is numericLuaError - if this is not a number or string convertible to numberpow(LuaValue)public LuaValue powWith(double lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
lhs - The left-hand-side value which will be raised to this power(lhs ^ this) if this is numericLuaError - if this is not a number or string convertible to numberpow(LuaValue),
pow(double),
#pow(int)public LuaValue powWith(long lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
lhs - The left-hand-side value which will be raised to this power(lhs ^ this) if this is numericLuaError - if this is not a number or string convertible to numberpow(LuaValue),
pow(double),
#pow(int)public LuaValue div(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the divulo with(this / rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the DIV metatag definedarithmt(LuaValue, LuaValue)public LuaValue div(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing div(LuaValue) must be used
rhs - The right-hand-side value to perform the divulo with(this / rhs) if this is numericLuaError - if this is not a number or string convertible to numberdiv(LuaValue)public LuaValue div(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing div(LuaValue) must be used
rhs - The right-hand-side value to perform the divulo with(this / rhs) if this is numericLuaError - if this is not a number or string convertible to numberdiv(LuaValue)public LuaValue divInto(double lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
lhs - The left-hand-side value which will be divided by this(lhs / this) if this is numericLuaError - if this is not a number or string convertible to numberdiv(LuaValue),
div(double),
#div(int)public LuaValue mod(LuaValue rhs)
Each operand must derive from LuaNumber
or derive from LuaString and be convertible to a number
rhs - The right-hand-side value to perform the modulo with(this % rhs) if both are numeric,
or LuaValue if metatag processing occursLuaError - if either operand is not a number or string convertible to number,
and neither has the MOD metatag definedarithmt(LuaValue, LuaValue)public LuaValue mod(double rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing mod(LuaValue) must be used
rhs - The right-hand-side value to perform the modulo with(this % rhs) if this is numericLuaError - if this is not a number or string convertible to numbermod(LuaValue)public LuaValue mod(long rhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
For metatag processing mod(LuaValue) must be used
rhs - The right-hand-side value to perform the modulo with(this % rhs) if this is numericLuaError - if this is not a number or string convertible to numbermod(LuaValue)public LuaValue modFrom(double lhs)
this must derive from LuaNumber
or derive from LuaString and be convertible to a number
lhs - The left-hand-side value which will be modulo'ed by this(lhs % this) if this is numericLuaError - if this is not a number or string convertible to numbermod(LuaValue),
mod(double),
#mod(int)protected LuaValue arithmt(LuaValue tag, LuaValue op2)
Finds the supplied metatag value for this or op2 and invokes it,
or throws LuaError if neither is defined.
tag - The metatag to look upop2 - The other operand value to perform the operation withLuaValue resulting from metatag processingLuaError - if metatag was not defined for either operandadd(LuaValue),
sub(LuaValue),
mul(LuaValue),
pow(LuaValue),
div(LuaValue),
mod(LuaValue),
ADD,
SUB,
MUL,
POW,
DIV,
MODprotected LuaValue arithmtwith(LuaValue tag, double op1)
Finds the supplied metatag value for this and invokes it,
or throws LuaError if neither is defined.
tag - The metatag to look upop1 - The value of the left-hand-side to perform the operation withLuaValue resulting from metatag processingLuaError - if metatag was not defined for either operandadd(LuaValue),
sub(LuaValue),
mul(LuaValue),
pow(LuaValue),
div(LuaValue),
mod(LuaValue),
ADD,
SUB,
MUL,
POW,
DIV,
MODpublic LuaValue lt(LuaValue rhs)
LuaValue.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this < rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if either both operands are not a strings or both are not numbers
and no LT metatag is defined.gteq_b(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue lt(double rhs)
LuaValue.
To be comparable, this must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this < rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if this is not a number
and no LT metatag is defined.gteq_b(double),
comparemt(LuaValue, LuaValue)public LuaValue lt(long rhs)
public boolean lt_b(LuaValue rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LT metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public boolean lt_b(long rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LT metatag is defined.#gteq(int),
comparemt(LuaValue, LuaValue)public boolean lt_b(double rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LT metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue lteq(LuaValue rhs)
LuaValue.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this <= rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if either both operands are not a strings or both are not numbers
and no LE metatag is defined.gteq_b(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue lteq(double rhs)
LuaValue.
To be comparable, this must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this <= rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if this is not a number
and no LE metatag is defined.gteq_b(double),
comparemt(LuaValue, LuaValue)public LuaValue lteq(long rhs)
public boolean lteq_b(LuaValue rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LE metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public boolean lteq_b(long rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LE metatag is defined.#gteq(int),
comparemt(LuaValue, LuaValue)public boolean lteq_b(double rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LE metatag is defined.gteq(double),
comparemt(LuaValue, LuaValue)public LuaValue gt(LuaValue rhs)
LuaValue.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this > rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if either both operands are not a strings or both are not numbers
and no LE metatag is defined.gteq_b(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue gt(double rhs)
LuaValue.
To be comparable, this must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this > rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if this is not a number
and no LE metatag is defined.gteq_b(double),
comparemt(LuaValue, LuaValue)public LuaValue gt(long rhs)
public boolean gt_b(LuaValue rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LE metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public boolean gt_b(long rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LE metatag is defined.#gteq(int),
comparemt(LuaValue, LuaValue)public boolean gt_b(double rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LE metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue gteq(LuaValue rhs)
LuaValue.
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this >= rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if either both operands are not a strings or both are not numbers
and no LT metatag is defined.gteq_b(LuaValue),
comparemt(LuaValue, LuaValue)public LuaValue gteq(double rhs)
LuaValue.
To be comparable, this must derive from LuaNumber.
rhs - The right-hand-side value to perform the comparison withTRUE if (this >= rhs), FALSE if not,
or LuaValue if metatag processing occursLuaError - if this is not a number
and no LT metatag is defined.gteq_b(double),
comparemt(LuaValue, LuaValue)public LuaValue gteq(long rhs)
public boolean gteq_b(LuaValue rhs)
To be comparable, both operands must derive from LuaString
or both must derive from LuaNumber.
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.LuaError - if either both operands are not a strings or both are not numbers
and no LT metatag is defined.gteq(LuaValue),
comparemt(LuaValue, LuaValue)public boolean gteq_b(long rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LT metatag is defined.#gteq(int),
comparemt(LuaValue, LuaValue)public boolean gteq_b(double rhs)
To be comparable, this must derive from LuaNumber.
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.LuaError - if this is not a number
and no LT metatag is defined.gteq(double),
comparemt(LuaValue, LuaValue)public LuaValue comparemt(LuaValue tag, LuaValue op1)
Finds the supplied metatag value and invokes it,
or throws LuaError if none applies.
tag - The metatag to look upop1 - The operand with which to to perform the operationLuaValue resulting from metatag processingLuaError - if metatag was not defined for either operand,
or if the operands are not the same type,
or the metatag values for the two operands are different.gt(LuaValue),
gteq(LuaValue),
lt(LuaValue),
lteq(LuaValue)public int strcmp(LuaValue rhs)
Only strings can be compared, meaning
each operand must derive from LuaString.
rhs - The right-hand-side value to perform the comparison with(this < rhs), int > 0 for (this > rhs), or 0 when same string.LuaError - if either operand is not a stringpublic int strcmp(LuaString rhs)
LuaString
using string comparison based on byte values.
Only strings can be compared, meaning
each operand must derive from LuaString.
rhs - The right-hand-side value to perform the comparison with(this < rhs), int > 0 for (this > rhs), or 0 when same string.LuaError - if this is not a stringpublic LuaValue concatTo(LuaValue lhs)
Only strings and numbers as represented can be concatenated, meaning
each operand must derive from LuaString or LuaNumber.
lhs - The left-hand-side value onto which this will be concatenatedLuaValue resulting from concatenation of (lhs .. this)LuaError - if either operand is not of an appropriate type,
such as nil or a tableconcat(LuaValue)public LuaValue concatTo(LuaNumber lhs)
LuaNumber
and return the result using rules of lua string concatenation including
metatag processing.
Only strings and numbers as represented can be concatenated, meaning
each operand must derive from LuaString or LuaNumber.
lhs - The left-hand-side value onto which this will be concatenatedLuaValue resulting from concatenation of (lhs .. this)LuaError - if either operand is not of an appropriate type,
such as nil or a tableconcat(LuaValue)public LuaValue concatTo(LuaString lhs)
LuaString
and return the result using rules of lua string concatenation including
metatag processing.
Only strings and numbers as represented can be concatenated, meaning
each operand must derive from LuaString or LuaNumber.
lhs - The left-hand-side value onto which this will be concatenatedLuaValue resulting from concatenation of (lhs .. this)LuaError - if either operand is not of an appropriate type,
such as nil or a tableconcat(LuaValue)public Buffer buffer()
Buffer for more efficient concatenation of
multiple strings.public LuaValue and(LuaValue rhs)
and with another operand, based on lua rules for boolean evaluation.
This returns either this or rhs depending on the boolean value for this.rhs - The right-hand-side value to perform the operation withthis if this.toboolean() is false, rhs otherwise.public LuaValue or(LuaValue rhs)
or with another operand, based on lua rules for boolean evaluation.
This returns either this or rhs depending on the boolean value for this.rhs - The right-hand-side value to perform the operation withthis if this.toboolean() is true, rhs otherwise.public boolean testfor_b(LuaValue limit, LuaValue step)
Used in lua-bytecode to Java-bytecode conversion.
limit - the numerical limit to complete the for loopstep - the numberical step size to use.public LuaString strvalue()
public LuaValue strongvalue()
public static LuaBoolean valueOf(boolean b)
LuaValue.public static LuaInteger valueOf(int i)
LuaValue.i - int value to convertLuaInteger instance, possibly pooled, whose value is ipublic static LuaNumber valueOf(long i)
public static LuaNumber valueOf(double d)
LuaValue.
This may return a LuaInteger or LuaDouble depending
on the value supplied.d - double value to convertLuaNumber instance, possibly pooled, whose value is dpublic static LuaString valueOf(String s)
LuaValue.s - String value to convertLuaString instance, possibly pooled, whose value is spublic static LuaString valueOf(byte[] bytes)
LuaValue.bytes - byte array to convertLuaString instance, possibly pooled, whose bytes are those in the supplied arraypublic static LuaString valueOf(byte[] bytes, int off, int len)
LuaValue.public static LuaTable tableOf()
LuaTable.LuaTable instance with no values and no metatable.public static LuaTable tableOf(Varargs varargs, int firstarg)
LuaTable initialized with supplied array values.public static LuaTable tableOf(int narray, int nhash)
LuaTable preallocated to hold array and hashed elementsnarray - Number of array elements to preallocatenhash - Number of hash elements to preallocateLuaTable instance with no values and no metatable, but preallocated for array and hashed elements.public static LuaTable listOf(LuaValue[] unnamedValues)
LuaTable initialized with supplied array values.public static LuaTable listOf(LuaValue[] unnamedValues, Varargs lastarg)
LuaTable initialized with supplied array values.public static LuaTable tableOf(LuaValue[] namedValues)
LuaTable initialized with supplied named values.public static LuaTable tableOf(LuaValue[] namedValues, LuaValue[] unnamedValues)
LuaTable initialized with supplied named values and sequential elements.
The named values will be assigned first, and the sequential elements will be assigned later,
possibly overwriting named values at the same slot if there are conflicts.namedValues - array of LuaValue containing the keys and values to use in initialization
in order {key-a, value-a, key-b, value-b, ...} unnamedValues - array of LuaValue containing the sequenctial elements to use in initialization
in order {value-1, value-2, ...} , or null if there are noneLuaTable instance with named and sequential values supplied.public static LuaTable tableOf(LuaValue[] namedValues, LuaValue[] unnamedValues, Varargs lastarg)
LuaTable initialized with supplied named values and sequential elements in an array part and as varargs.
The named values will be assigned first, and the sequential elements will be assigned later,
possibly overwriting named values at the same slot if there are conflicts.namedValues - array of LuaValue containing the keys and values to use in initialization
in order {key-a, value-a, key-b, value-b, ...} unnamedValues - array of LuaValue containing the first sequenctial elements to use in initialization
in order {value-1, value-2, ...} , or null if there are nonelastarg - Varargs containing additional values to use in the sequential part of the initialization,
to be put after the last unnamedValues elementLuaTable instance with named and sequential values supplied.public static LuaUserdata userdataOf(Object o)
o - The java instance to be wrapped as userdataLuaUserdata value wrapping the java instance.public static LuaUserdata userdataOf(Object o, LuaValue metatable)
o - The java instance to be wrapped as userdatametatable - The metatble to associate with the userdata instance.LuaUserdata value wrapping the java instance.protected static LuaValue gettable(LuaValue t, LuaValue key)
protected static boolean settable(LuaValue t, LuaValue key, LuaValue value)
t - LuaValue on which value is being set, typically a table or something with the metatag NEWINDEX definedkey - LuaValue naming the field to assignvalue - LuaValue the new value to assign to keyLuaError - if there is a loop in metatag processingpublic LuaValue metatag(LuaValue tag)
NIL if it doesn't existprotected LuaValue checkmetatag(LuaValue tag, String reason)
LuaError if it doesn't existprotected static org.luaj.vm2.Metatable metatableOf(LuaValue mt)
public static Varargs varargsOf(LuaValue[] v)
v - The array of LuaValuesVarargs wrapping the supplied values.varargsOf(LuaValue, Varargs),
varargsOf(LuaValue[], int, int)public static Varargs varargsOf(LuaValue[] v, Varargs r)
v - The array of LuaValuesr - Varargs contain values to include at the endVarargs wrapping the supplied values.varargsOf(LuaValue[]),
varargsOf(LuaValue[], int, int, Varargs)public static Varargs varargsOf(LuaValue[] v, int offset, int length)
v - The array of LuaValuesoffset - number of initial values to skip in the arraylength - number of values to include from the arrayVarargs wrapping the supplied values.varargsOf(LuaValue[]),
varargsOf(LuaValue[], int, int, Varargs)public static Varargs varargsOf(LuaValue[] v, int offset, int length, Varargs more)
Varargs around an array of LuaValues.
Caller must ensure that array contents are not mutated after this call
or undefined behavior will result.v - The array of LuaValuesoffset - number of initial values to skip in the arraylength - number of values to include from the arraymore - Varargs contain values to include at the endVarargs wrapping the supplied values.varargsOf(LuaValue[], Varargs),
varargsOf(LuaValue[], int, int)public static Varargs tailcallOf(LuaValue func, Varargs args)
TailcallVarargs around a function and arguments.
The tail call is not yet called or processing until the client invokes
TailcallVarargs.eval() which performs the tail call processing.
This method is typically not used directly by client code. Instead use one of the function invocation methods.
func - LuaValue to be called as a tail callargs - Varargs containing the arguments to the callTailcallVarargs to be used in tailcall oprocessing.call(),
invoke(),
method(LuaValue),
invokemethod(LuaValue)public Varargs onInvoke(Varargs args)
This may return a TailcallVarargs to be evaluated by the client.
This should not be called directly, instead use one of the call invocation functions.
args - the arguments to the call invocation.call(),
invoke(),
method(LuaValue),
invokemethod(LuaValue)public void initupvalue1(LuaValue env)
env - The environment to load into the first upvalue, if there is one.public void setuservalue(LuaValue uservalue)
public LuaValue getuservalue()
public LuaValue idiv(long rhs)
public LuaValue band(long rhs)
public LuaValue bor(long rhs)
public LuaValue bxor(long rhs)
public LuaValue shl(long rhs)
public LuaValue shr(long rhs)
public LuaValue bnot()
public void setfenv(LuaValue env)
public LuaValue getfenv()
Copyright © 2020. All rights reserved.