Package com.prineside.luaj
Class TailcallVarargs
java.lang.Object
com.prineside.luaj.Varargs
com.prineside.luaj.TailcallVarargs
Subclass of
Varargs
that represents a lua tail call
in a Java library function execution environment.
Since Java doesn't have direct support for tail calls,
any lua function whose Prototype
contains the
Lua.OP_TAILCALL
bytecode needs a mechanism
for tail calls when converting lua-bytecode to java-bytecode.
The tail call holds the next function and arguments,
and the client a call to eval()
executes the function
repeatedly until the tail calls are completed.
Normally, users of luaj need not concern themselves with the details of this mechanism, as it is built into the core execution framework.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.prineside.luaj.Varargs
Varargs.ArrayVarargs
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarg
(int i) Get the n-th argument value (1-based).arg1()
Get the first argument in the list.eval()
Evaluate any pending tail call and return result.boolean
Return true if this is a TailcallVarargsint
narg()
Get the number of arguments, or 0 if there are none.subargs
(int start) Create aVarargs
instance containing arguments starting at indexstart
Methods inherited from class com.prineside.luaj.Varargs
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, checkjstring, checklong, checknotnil, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, checkvalue, dealias, isfunction, isnil, isnoneornil, isnumber, isstring, istable, isthread, isuserdata, isvalue, optboolean, optclosure, optdouble, optfunction, optint, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tojstring, tolong, toshort, toString, touserdata, touserdata, type
-
Constructor Details
-
TailcallVarargs
- Parameters:
args
- are stored in this object and will be freed after eval()
-
-
Method Details
-
isTailcall
public boolean isTailcall()Description copied from class:Varargs
Return true if this is a TailcallVarargs- Overrides:
isTailcall
in classVarargs
- Returns:
- true if a tail call, false otherwise
-
eval
Description copied from class:Varargs
Evaluate any pending tail call and return result. -
arg
Description copied from class:Varargs
Get the n-th argument value (1-based). -
arg1
Description copied from class:Varargs
Get the first argument in the list. -
narg
public int narg()Description copied from class:Varargs
Get the number of arguments, or 0 if there are none. -
subargs
Description copied from class:Varargs
Create aVarargs
instance containing arguments starting at indexstart
-