diff src/luan/modules/TableLuan.java @ 1563:8fbcc4747091

remove LuanFunction.luan
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 09 Nov 2020 01:37:57 -0700
parents b89212fd04b5
children c922446f53aa
line wrap: on
line diff
--- a/src/luan/modules/TableLuan.java	Sun Nov 08 16:50:59 2020 -0700
+++ b/src/luan/modules/TableLuan.java	Mon Nov 09 01:37:57 2020 -0700
@@ -15,7 +15,7 @@
 
 	public static String concat(Luan luan,LuanTable list,String sep,Integer i,Integer j) throws LuanException {
 		int first = i==null ? 1 : i;
-		int last = j==null ? list.length() : j;
+		int last = j==null ? list.length(luan) : j;
 		StringBuilder buf = new StringBuilder();
 		for( int k=first; k<=last; k++ ) {
 			Object val = list.get(luan,k);
@@ -23,7 +23,7 @@
 				break;
 			if( sep!=null && k > first )
 				buf.append(sep);
-			String s = Luan.luanToString(val);
+			String s = luan.luanToString(val);
 			buf.append(s);
 		}
 		return buf.toString();
@@ -46,7 +46,7 @@
 		public boolean isLessThan(Object o1,Object o2);
 	}
 
-	public static void sort(LuanTable list,final LuanFunction comp) throws LuanException {
+	public static void sort(Luan luan,LuanTable list,final LuanFunction comp) throws LuanException {
 		if( list.getMetatable() != null )
 			throw new LuanException("can't sort a table with a metatable");
 		final LessThan lt;
@@ -54,7 +54,7 @@
 			lt = new LessThan() {
 				public boolean isLessThan(Object o1,Object o2) {
 					try {
-						return Luan.isLessThan(o1,o2);
+						return luan.isLessThan(o1,o2);
 					} catch(LuanException e) {
 						throw new LuanRuntimeException(e);
 					}
@@ -64,7 +64,7 @@
 			lt = new LessThan() {
 				public boolean isLessThan(Object o1,Object o2) {
 					try {
-						return Luan.checkBoolean(Luan.first(comp.call(o1,o2)));
+						return Luan.checkBoolean(Luan.first(comp.call(luan,o1,o2)));
 					} catch(LuanException e) {
 						throw new LuanRuntimeException(e);
 					}
@@ -95,7 +95,7 @@
 			to = iTo;
 		} else {
 			Integer n = Luan.asInteger( tbl.get(luan,"n") );
-			to = n!=null ? n : tbl.length();
+			to = n!=null ? n : tbl.length(luan);
 		}
 		List<Object> list = new ArrayList<Object>();
 		for( int i=from; i<=to; i++ ) {