diff src/luan/interp/Closure.java @ 49:8ede219cd111

add WebShell git-svn-id: https://luan-java.googlecode.com/svn/trunk@50 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 28 Dec 2012 19:35:04 +0000
parents 64ecb7a3aad7
children 4bf3d0c0b6b9
line wrap: on
line diff
--- a/src/luan/interp/Closure.java	Fri Dec 28 03:29:12 2012 +0000
+++ b/src/luan/interp/Closure.java	Fri Dec 28 19:35:04 2012 +0000
@@ -11,7 +11,7 @@
 	final UpValue[] upValues;
 	private final static UpValue[] NO_UP_VALUES = new UpValue[0];
 
-	Closure(Chunk chunk,LuanStateImpl lua) {
+	Closure(LuanStateImpl luan,Chunk chunk) {
 		this.chunk = chunk;
 		UpValue.Getter[] upValueGetters = chunk.upValueGetters;
 		if( upValueGetters.length==0 ) {
@@ -19,16 +19,16 @@
 		} else {
 			upValues = new UpValue[upValueGetters.length];
 			for( int i=0; i<upValues.length; i++ ) {
-				upValues[i] = upValueGetters[i].get(lua);
+				upValues[i] = upValueGetters[i].get(luan);
 			}
 		}
 	}
 
-	public Object[] call(LuanState lua,Object[] args) throws LuanException {
-		return call(this,(LuanStateImpl)lua,args);
+	public Object[] call(LuanState luan,Object[] args) throws LuanException {
+		return call(this,(LuanStateImpl)luan,args);
 	}
 
-	private static Object[] call(Closure closure,LuanStateImpl lua,Object[] args) throws LuanException {
+	private static Object[] call(Closure closure,LuanStateImpl luan,Object[] args) throws LuanException {
 		while(true) {
 			Chunk chunk = closure.chunk;
 			Object[] varArgs = null;
@@ -42,7 +42,7 @@
 					varArgs = LuanFunction.EMPTY_RTN;
 				}
 			}
-			Object[] stack = lua.newFrame(closure,chunk.stackSize,varArgs);
+			Object[] stack = luan.newFrame(closure,chunk.stackSize,varArgs);
 			final int n = Math.min(args.length,chunk.numArgs);
 			for( int i=0; i<n; i++ ) {
 				stack[i] = args[i];
@@ -50,12 +50,12 @@
 			Object[] returnValues;
 			Closure tailFn;
 			try {
-				chunk.block.eval(lua);
+				chunk.block.eval(luan);
 			} catch(ReturnException e) {
 			} finally {
-				returnValues = lua.returnValues;
-				closure = lua.tailFn;
-				lua.popFrame();
+				returnValues = luan.returnValues;
+				closure = luan.tailFn;
+				luan.popFrame();
 			}
 			if( closure == null )
 				return returnValues;