Mercurial Hosting > luan
diff core/src/luan/impl/LuanStateImpl.java @ 647:8e8c30b72e9b
move methods from LuanState to Luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 20:39:14 -0600 |
parents | cdc70de628b5 |
children | 140cc5191b7a |
line wrap: on
line diff
--- a/core/src/luan/impl/LuanStateImpl.java Tue Mar 29 19:58:39 2016 -0600 +++ b/core/src/luan/impl/LuanStateImpl.java Tue Mar 29 20:39:14 2016 -0600 @@ -117,38 +117,4 @@ } - - @Override public boolean isLessThan(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(this,new Object[]{o1,o2})) ); - throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); - } - - 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; - } - - LuanFunction getHandlerFunction(String op,LuanTable t) throws LuanException { - Object f = t.getHandler(op); - if( f == null ) - return null; - return checkFunction(f); - } - }