diff src/luan/impl/LuanImpl.java @ 1334:c88b486a9511

make some Luan methods static
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 12 Feb 2019 22:53:57 -0700
parents 25746915a241
children e0cf0d108a77
line wrap: on
line diff
--- a/src/luan/impl/LuanImpl.java	Tue Feb 12 22:33:40 2019 -0700
+++ b/src/luan/impl/LuanImpl.java	Tue Feb 12 22:53:57 2019 -0700
@@ -33,7 +33,7 @@
 		if( o instanceof Number )
 			return -((Number)o).doubleValue();
 		if( o instanceof LuanTable ) {
-			LuanFunction fn = luan.getHandlerFunction("__unm",(LuanTable)o);
+			LuanFunction fn = Luan.getHandlerFunction("__unm",(LuanTable)o);
 			if( fn != null ) {
 				return Luan.first(fn.call(luan,new Object[]{o}));
 			}
@@ -42,7 +42,7 @@
 	}
 
 	private static Object arithmetic(Luan luan,String op,Object o1,Object o2) throws LuanException {
-		LuanFunction fn = luan.getBinHandler(op,o1,o2);
+		LuanFunction fn = Luan.getBinHandler(op,o1,o2);
 		if( fn != null )
 			return Luan.first(fn.call(luan,new Object[]{o1,o2}));
 		String type = !(o1 instanceof Number) ? Luan.type(o1) : Luan.type(o2);
@@ -89,11 +89,11 @@
 	}
 
 	public static Object concat(Luan luan,Object o1,Object o2) throws LuanException {
-		LuanFunction fn = luan.getBinHandler("__concat",o1,o2);
+		LuanFunction fn = Luan.getBinHandler("__concat",o1,o2);
 		if( fn != null )
 			return Luan.first(fn.call(luan,new Object[]{o1,o2}));
-		String s1 = luan.toString(o1);
-		String s2 = luan.toString(o2);
+		String s1 = Luan.luanToString(o1);
+		String s2 = Luan.luanToString(o2);
 		return s1 + s2;
 	}
 
@@ -136,10 +136,10 @@
 			String s2 = (String)o2;
 			return s1.compareTo(s2) <= 0;
 		}
-		LuanFunction fn = luan.getBinHandler("__le",o1,o2);
+		LuanFunction fn = Luan.getBinHandler("__le",o1,o2);
 		if( fn != null )
 			return Luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) );
-		fn = luan.getBinHandler("__lt",o1,o2);
+		fn = Luan.getBinHandler("__lt",o1,o2);
 		if( fn != null )
 			return !Luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o2,o1})) );
 		throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) );