Fix upvalues that allow closures to work properly.
This commit is contained in:
@@ -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] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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+")";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user