2007-06-08 05:11:37 +00:00
|
|
|
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++ )
|
2007-06-14 04:09:57 +00:00
|
|
|
upVals[i] = new UpVal( p.upvalues[i] );
|
2007-06-08 05:11:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// perform a lua call
|
2007-06-15 06:41:40 +00:00
|
|
|
public void luaStackCall(StackState state, int base, int top) {
|
|
|
|
|
state.setupCall( this, base, top );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
|
return "closure: "+hashCode();
|
2007-06-08 05:11:37 +00:00
|
|
|
}
|
|
|
|
|
}
|