diff src/luan/modules/ThreadLuan.java @ 1562:b89212fd04b5

remove table.luan
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 08 Nov 2020 16:50:59 -0700
parents 78d937870762
children 8fbcc4747091
line wrap: on
line diff
--- a/src/luan/modules/ThreadLuan.java	Thu Nov 05 20:24:09 2020 -0700
+++ b/src/luan/modules/ThreadLuan.java	Sun Nov 08 16:50:59 2020 -0700
@@ -157,17 +157,17 @@
 		}
 	}
 
-	private static Object makeSafe(Luan luan,Object v) throws LuanException {
+	private static Object makeSafe(Object v) throws LuanException {
 		if( v instanceof LuanTable ) {
 			LuanTable tbl = (LuanTable)v;
 			if( tbl.getMetatable() != null )
 				return new Unsafe("table with metatable");
-			LuanTable rtn = new LuanTable(luan);
+			LuanTable rtn = new LuanTable();
 			for( Map.Entry entry : tbl.rawIterable() ) {
-				Object key = makeSafe( luan, entry.getKey() );
+				Object key = makeSafe( entry.getKey() );
 				if( key instanceof Unsafe )
 					return key;
-				Object value = makeSafe( luan, entry.getValue() );
+				Object value = makeSafe( entry.getValue() );
 				if( value instanceof Unsafe )
 					return value;
 				rtn.rawPut(key,value);
@@ -176,7 +176,7 @@
 		} else if( v instanceof Object[] ) {
 			Object[] a = (Object[])v;
 			for( int i=0; i<a.length; i++ ) {
-				Object obj = makeSafe(luan,a[i]);
+				Object obj = makeSafe(a[i]);
 				if( obj instanceof Unsafe )
 					return obj;
 				a[i] = obj;
@@ -200,18 +200,18 @@
 		}
 
 		public synchronized Object call(Luan callerLuan,String fnName,Object... args) throws LuanException {
-			Object obj = makeSafe(luan,args);
+			Object obj = makeSafe(args);
 			if( obj instanceof Unsafe )
 				throw new LuanException("can't pass "+((Unsafe)obj).reason+" to global_callable "+Arrays.asList(args));
 			args = (Object[])obj;
-			Object f = fns.get(fnName);
+			Object f = fns.get(luan,fnName);
 			if( f == null )
 				throw new LuanException("function '"+fnName+"' not found in global_callable");
 			if( !(f instanceof LuanFunction) )
 				throw new LuanException("value of '"+fnName+"' not a function in global_callable");
 			LuanFunction fn = (LuanFunction)f;
 			Object rtn = fn.call(args);
-			rtn = makeSafe(callerLuan,rtn);
+			rtn = makeSafe(rtn);
 			if( rtn instanceof Unsafe )
 				throw new LuanException("can't return "+((Unsafe)rtn).reason+" from global_callable");
 			return rtn;