Class LuaClosure
- All Implemented Interfaces:
 com.esotericsoftware.kryo.KryoSerializable
- 
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class com.prineside.luaj.LuaValue
LuaValue.NillableSerializer, LuaValue.NoneNested classes/interfaces inherited from class com.prineside.luaj.Varargs
Varargs.ArrayVarargs - 
Field Summary
FieldsFields inherited from class com.prineside.luaj.LuaFunction
s_metatableFields inherited from class com.prineside.luaj.LuaValue
ADD, CALL, CONCAT, DIV, EMPTYSTRING, ENV, EQ, FALSE, INDEX, LE, LEN, LT, METATABLE, MINUSONE, MOD, MODE, MUL, NEWINDEX, NIL, NILLABLE_SERIALIZER, NILS, NONE, NOVALS, ONE, POW, SUB, TBOOLEAN, TFUNCTION, TINT, TLIGHTUSERDATA, TNIL, TNONE, TNUMBER, TOSTRING, TRUE, TSTRING, TTABLE, TTHREAD, TUSERDATA, TVALUE, TYPE_NAMES, UNM, ZERO - 
Constructor Summary
ConstructorsConstructorDescriptionLuaClosure(Prototype p, LuaValue env) Create a closure around a Prototype with a specific environment. - 
Method Summary
Modifier and TypeMethodDescriptionfinal LuaValuecall()Callthiswith 0 arguments, including metatag processing, and return only the first return value.final LuaValueCallthiswith 1 argument, including metatag processing, and return only the first return value.final LuaValueCallthiswith 2 arguments, including metatag processing, and return only the first return value.final LuaValueCallthiswith 3 arguments, including metatag processing, and return only the first return value.Check that the value is aLuaClosure, or throwLuaErrorif notvoidprotected LuaValuegetUpvalue(int i) voidinitupvalue1(LuaValue env) Hook for implementations such as LuaJC to load the environment of the main chunk into the first upvalue location.final VarargsShould not return args (must be new varargs)booleanCheck ifthisis afunctionthat is a closure, meaning interprets lua bytecode for its executionname()Return a human-readable name for this function.final VarargsCallback used during tail call processing to invoke the function once.optclosure(LuaClosure defval) Check that optional argument is a closure and return asLuaClosurevoidread(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) protected voidsetUpvalue(int i, LuaValue v) Convert to human readable String for any type.voidwrite(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) Methods inherited from class com.prineside.luaj.LuaFunction
checkfunction, classnamestub, getmetatable, isfunction, optfunction, strvalue, type, typenameMethods inherited from class com.prineside.luaj.LuaValue
add, add, add, and, arg, arg1, argerror, argerror, aritherror, aritherror, arithmt, arithmtwith, assert_, buffer, call, callmt, cBool, cDouble, cFloat, checkboolean, checkdouble, checkglobals, checkint, checkjstring, checklong, checkmetatag, checknotnil, checknumber, checknumber, checkstring, checktable, checkthread, checkuserdata, checkuserdata, cInt, cNcDouble, cNcFloat, cNcInt, cObject, compareerror, compareerror, comparemt, concat, concat, concatmt, concatTo, concatTo, concatTo, cRegObject, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, cVarargs, div, div, div, divInto, eq, eq_b, eqmtcall, equals, error, get, get, get, gettable, gt, gt, gt, gt_b, gt_b, gt_b, gteq, gteq, gteq, gteq_b, gteq_b, gteq_b, illegal, inext, invoke, invoke, invoke, invokemethod, invokemethod, invokemethod, invokemethod, isboolean, isint, isinttype, islong, isnil, isnumber, isRegObject, isstring, istable, isthread, isuserdata, isuserdata, isvalidkey, len, lenerror, length, listOf, listOf, load, lt, lt, lt, lt_b, lt_b, lt_b, lteq, lteq, lteq, lteq_b, lteq_b, lteq_b, markAsConst, metatableOf, metatag, method, method, method, method, method, method, mod, mod, mod, modFrom, mul, mul, mul, narg, neg, neq, neq_b, next, not, optboolean, optdouble, optint, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, or, pow, pow, pow, powWith, powWith, presize, raweq, raweq, raweq, raweq, raweq, rawget, rawget, rawget, rawlen, rawset, rawset, rawset, rawset, rawset, rawset, rawset, rawsetlist, set, set, set, set, set, set, set, setmetatable, settable, strcmp, strcmp, strongvalue, sub, sub, sub, subargs, subFrom, subFrom, tableOf, tableOf, tableOf, tableOf, tableOf, tableOf, tailcallOf, testfor_b, toboolean, tobyte, tochar, todouble, tofloat, toint, tolong, tonumber, toshort, tostring, toString, touserdata, touserdata, typerror, unimplemented, userdataOf, userdataOf, valueOf, valueOf, valueOf, valueOf, valueOf, valueOfMethods inherited from class com.prineside.luaj.Varargs
argcheck, checkboolean, checkclosure, checkdouble, checkfunction, checkint, 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, optjstring, optlong, optnumber, optstring, opttable, optthread, optuserdata, optuserdata, optvalue, toboolean, tobyte, tochar, todouble, tofloat, toint, tojstring, tolong, toshort, touserdata, touserdata, type 
- 
Field Details
- 
p
 - 
upValues
 
 - 
 - 
Constructor Details
- 
LuaClosure
Create a closure around a Prototype with a specific environment. If the prototype has upvalues, the environment will be written into the first upvalue.- Parameters:
 p- the Prototype to construct this Closure for.env- the environment to associate with the closure.
 
 - 
 - 
Method Details
- 
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
 writein interfacecom.esotericsoftware.kryo.KryoSerializable
 - 
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
 readin interfacecom.esotericsoftware.kryo.KryoSerializable
 - 
initupvalue1
Description copied from class:LuaValueHook for implementations such as LuaJC to load the environment of the main chunk into the first upvalue location. If the function has no upvalues or is not a main chunk, calling this will be no effect.- Overrides:
 initupvalue1in classLuaValue- Parameters:
 env- The environment to load into the first upvalue, if there is one.
 - 
isclosure
public boolean isclosure()Description copied from class:LuaValueCheck ifthisis afunctionthat is a closure, meaning interprets lua bytecode for its execution - 
optclosure
Description copied from class:LuaValueCheck that optional argument is a closure and return asLuaClosureA
LuaClosureis aLuaFunctionthat executes lua byteccode.- Overrides:
 optclosurein classLuaValue- Parameters:
 defval-LuaClosureto return ifthisis nil or none- Returns:
 thiscast toLuaClosureif a function,defvalif nil or none, throwsLuaErrorotherwise- See Also:
 
 - 
checkclosure
Description copied from class:LuaValueCheck that the value is aLuaClosure, or throwLuaErrorif notLuaClosureis a subclass ofLuaFunctionthat interprets lua bytecode.- Overrides:
 checkclosurein classLuaValue- Returns:
 thiscast asLuaClosure- See Also:
 
 - 
tojstring
Description copied from class:LuaValueConvert to human readable String for any type.- Overrides:
 tojstringin classLuaFunction- Returns:
 - String for use by human readers based on type.
 - See Also:
 
 - 
freeStack
 - 
call
Description copied from class:LuaValueCallthiswith 0 arguments, including metatag processing, and return only the first return value.If
thisis aLuaFunction, call it, and return only its first return value, dropping any others. Otherwise, look for theLuaValue.CALLmetatag and call that.If the return value is a
Varargs, only the 1st value will be returned. To get multiple values, useLuaValue.invoke()instead.To call
thisas a method call, useLuaValue.method(LuaValue)instead.- Overrides:
 callin classLuaValue- Returns:
 - First return value 
(this()), orLuaValue.NILif there were none. - See Also:
 
 - 
call
Description copied from class:LuaValueCallthiswith 1 argument, including metatag processing, and return only the first return value.If
thisis aLuaFunction, call it, and return only its first return value, dropping any others. Otherwise, look for theLuaValue.CALLmetatag and call that.If the return value is a
Varargs, only the 1st value will be returned. To get multiple values, useLuaValue.invoke()instead.To call
thisas a method call, useLuaValue.method(LuaValue)instead.- Overrides:
 callin classLuaValue- Parameters:
 arg- First argument to supply to the called function- Returns:
 - First return value 
(this(arg)), orLuaValue.NILif there were none. - See Also:
 
 - 
call
Description copied from class:LuaValueCallthiswith 2 arguments, including metatag processing, and return only the first return value.If
thisis aLuaFunction, call it, and return only its first return value, dropping any others. Otherwise, look for theLuaValue.CALLmetatag and call that.If the return value is a
Varargs, only the 1st value will be returned. To get multiple values, useLuaValue.invoke()instead.To call
thisas a method call, useLuaValue.method(LuaValue)instead.- Overrides:
 callin classLuaValue- Parameters:
 arg1- First argument to supply to the called functionarg2- Second argument to supply to the called function- Returns:
 - First return value 
(this(arg1,arg2)), orLuaValue.NILif there were none. - See Also:
 
 - 
call
Description copied from class:LuaValueCallthiswith 3 arguments, including metatag processing, and return only the first return value.If
thisis aLuaFunction, call it, and return only its first return value, dropping any others. Otherwise, look for theLuaValue.CALLmetatag and call that.If the return value is a
Varargs, only the 1st value will be returned. To get multiple values, useLuaValue.invoke()instead.To call
thisas a method call, useLuaValue.method(LuaValue)instead.- Overrides:
 callin classLuaValue- Parameters:
 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- Returns:
 - First return value 
(this(arg1,arg2,arg3)), orLuaValue.NILif there were none. - See Also:
 
 - 
invoke
Description copied from class:LuaValueShould not return args (must be new varargs) - 
onInvoke
Description copied from class:LuaValueCallback used during tail call processing to invoke the function once.This may return a
TailcallVarargsto be evaluated by the client.This should not be called directly, instead use one of the call invocation functions.
 - 
getUpvalue
 - 
setUpvalue
 - 
name
Description copied from class:LuaFunctionReturn a human-readable name for this function. Returns the last part of the class name by default. Is overridden by LuaClosure to return the source file and line, and by LibFunctions to return the name.- Overrides:
 namein classLuaFunction- Returns:
 - common name for this function.
 
 
 -