diff src/luan/Luan.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/Luan.java	Sun Nov 08 16:50:59 2020 -0700
+++ b/src/luan/Luan.java	Mon Nov 09 01:37:57 2020 -0700
@@ -69,17 +69,17 @@
 	}
 
 	public Object eval(String cmd,Object... args) throws LuanException {
-		return load(cmd,"eval",false).call(args);
+		return load(cmd,"eval",false).call(this,args);
 	}
 
 	public Object require(String modName) throws LuanException {
 		return PackageLuan.require(this,modName);
 	}
 
-	public static String luanToString(Object obj) throws LuanException {
+	public String luanToString(Object obj) throws LuanException {
 		if( obj instanceof LuanTable ) {
 			LuanTable tbl = (LuanTable)obj;
-			return tbl.toStringLuan();
+			return tbl.toStringLuan(this);
 		}
 		if( obj == null )
 			return "nil";
@@ -101,7 +101,7 @@
 	}
 
 
-	public static boolean isLessThan(Object o1,Object o2) throws LuanException {
+	public boolean isLessThan(Object o1,Object o2) throws LuanException {
 		if( o1 instanceof Number && o2 instanceof Number ) {
 			Number n1 = (Number)o1;
 			Number n2 = (Number)o2;
@@ -114,7 +114,7 @@
 		}
 		LuanFunction fn = getBinHandler("__lt",o1,o2);
 		if( fn != null )
-			return Luan.checkBoolean( Luan.first(fn.call(o1,o2)) );
+			return Luan.checkBoolean( Luan.first(fn.call(this,o1,o2)) );
 		throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) );
 	}
 
@@ -172,7 +172,7 @@
 	public static void main(String[] args) throws LuanException {
 		Luan luan = new Luan();
 		LuanFunction fn = loadClasspath(luan,"luan/cmd_line.luan");
-		fn.call((Object[])args);
+		fn.call(luan,(Object[])args);
 	}
 
 	public static LuanFunction loadClasspath(Luan luan,String classpath)