Mercurial Hosting > luan
diff src/luan/impl/LuanImpl.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 | ba4daf107e07 |
children | 9fa8b8389578 |
line wrap: on
line diff
--- a/src/luan/impl/LuanImpl.java Wed Feb 07 23:16:12 2018 -0700 +++ b/src/luan/impl/LuanImpl.java Thu Feb 08 02:22:51 2018 -0700 @@ -34,7 +34,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})); } @@ -43,7 +43,7 @@ } private static Object arithmetic(LuanState 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); @@ -90,7 +90,7 @@ } public static Object concat(LuanState 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); @@ -137,17 +137,17 @@ 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) ); } public static boolean lt(LuanState luan,Object o1,Object o2) throws LuanException { - return Luan.isLessThan(luan,o1,o2); + return luan.isLessThan(o1,o2); } public static boolean cnd(Object o) throws LuanException {