Mercurial Hosting > luan
diff src/luan/interp/LtExpr.java @ 44:57054fa43189
implement table lib
git-svn-id: https://luan-java.googlecode.com/svn/trunk@45 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Wed, 26 Dec 2012 23:53:25 +0000 |
parents | e3624b7cd603 |
children | a443637829c1 |
line wrap: on
line diff
--- a/src/luan/interp/LtExpr.java Tue Dec 25 03:42:42 2012 +0000 +++ b/src/luan/interp/LtExpr.java Wed Dec 26 23:53:25 2012 +0000 @@ -16,19 +16,6 @@ @Override public Object eval(LuaStateImpl lua) throws LuaException { Object o1 = op1.eval(lua); Object o2 = op2.eval(lua); - if( o1 instanceof LuaNumber && o2 instanceof LuaNumber ) { - LuaNumber n1 = (LuaNumber)o1; - LuaNumber n2 = (LuaNumber)o2; - return n1.compareTo(n2) < 0; - } - if( o1 instanceof String && o2 instanceof String ) { - String s1 = (String)o1; - String s2 = (String)o2; - return s1.compareTo(s2) < 0; - } - LuaFunction fn = lua.getBinHandler(se,"__lt",o1,o2); - if( fn != null ) - return Lua.toBoolean( Lua.first(lua.call(fn,se,"__lt",o1,o2)) ); - throw new LuaException( lua, se, "attempt to compare " + Lua.type(o1) + " with " + Lua.type(o2) ); + return lua.isLessThan(se,o1,o2); } }