Fix upvalues that allow closures to work properly.

This commit is contained in:
James Roseborough
2007-06-14 04:09:57 +00:00
parent 4b7bbc1d8e
commit 14108aee87
4 changed files with 37 additions and 3 deletions

View File

@@ -14,7 +14,7 @@ public class Closure extends LValue {
this.p = p;
upVals = new UpVal[p.nups];
for ( int i=0; i<p.nups; i++ )
upVals[i] = new UpVal();
upVals[i] = new UpVal( p.upvalues[i] );
}

View File

@@ -1,5 +1,20 @@
package lua.io;
import lua.value.LNil;
import lua.value.LString;
import lua.value.LValue;
public class UpVal {
private LString name;
public LValue value;
public UpVal( LString string ) {
this.name = string;
}
public String toString() {
return "up("+name+")";
}
}