Initial draft of interpreter. Lua compiled "chunks" can be unmarshalled. Approximately half of bytecodes implemented in some form or another.
This commit is contained in:
23
src/main/java/lua/io/Closure.java
Normal file
23
src/main/java/lua/io/Closure.java
Normal file
@@ -0,0 +1,23 @@
|
||||
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, int nresults) {
|
||||
state.vmExecute( this, base+1 );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user