Mercurial Hosting > luan
diff src/luan/Luan.java @ 1166:7ef40e1923b7
add back Thread.global
allow metatables to have metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 08 Feb 2018 02:22:51 -0700 |
parents | 1f9d34a6f308 |
children | ce3279ef1bd9 |
line wrap: on
line diff
--- a/src/luan/Luan.java Wed Feb 07 23:16:12 2018 -0700 +++ b/src/luan/Luan.java Thu Feb 08 02:22:51 2018 -0700 @@ -114,39 +114,6 @@ throw new LuanException("attempt to call a " + Luan.type(obj) + " value" ); } - public static boolean isLessThan(LuanState luan,Object o1,Object o2) throws LuanException { - if( o1 instanceof Number && o2 instanceof Number ) { - Number n1 = (Number)o1; - Number n2 = (Number)o2; - return n1.doubleValue() < n2.doubleValue(); - } - if( o1 instanceof String && o2 instanceof String ) { - String s1 = (String)o1; - String s2 = (String)o2; - return s1.compareTo(s2) < 0; - } - LuanFunction fn = getBinHandler("__lt",o1,o2); - if( fn != null ) - return checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) ); - throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); - } - - public static LuanFunction getBinHandler(String op,Object o1,Object o2) throws LuanException { - if( o1 instanceof LuanTable ) { - LuanFunction f1 = getHandlerFunction(op,(LuanTable)o1); - if( f1 != null ) - return f1; - } - return o2 instanceof LuanTable ? getHandlerFunction(op,(LuanTable)o2) : null; - } - - public static LuanFunction getHandlerFunction(String op,LuanTable t) throws LuanException { - Object f = t.getHandler(op); - if( f == null ) - return null; - return checkFunction(f); - } - public static LuanFunction load(String text,String sourceName,LuanTable env) throws LuanException {