Files
luaj/src/main/java/lua/io/Closure.java

26 lines
567 B
Java
Raw Normal View History

package lua.io;
import lua.StackState;
import lua.value.LValue;
public class Closure extends LValue {
public LValue env;
public Proto p;
public UpVal[] upVals;
public Closure(StackState state, Proto p) {
this.env = state.gt();
this.p = p;
upVals = new UpVal[p.nups];
for ( int i=0; i<p.nups; i++ )
upVals[i] = new UpVal();
}
// perform a lua call
public void luaStackCall(StackState state, int base) {
2007-06-12 06:22:55 +00:00
if ( (! p.is_vararg) || (state.top < base+1+p.numparams) )
state.adjustTop( base+1+p.numparams );
state.vmExecute( this, base+1 );
}
}