Mercurial Hosting > luan
comparison src/luan/interp/LeExpr.java @ 46:a443637829c1
remove LuaNumber
git-svn-id: https://luan-java.googlecode.com/svn/trunk@47 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 27 Dec 2012 01:48:36 +0000 |
parents | e3624b7cd603 |
children | 64ecb7a3aad7 |
comparison
equal
deleted
inserted
replaced
45:b1b14d09fc98 | 46:a443637829c1 |
---|---|
1 package luan.interp; | 1 package luan.interp; |
2 | 2 |
3 import luan.Lua; | 3 import luan.Lua; |
4 import luan.LuaNumber; | |
5 import luan.LuaFunction; | 4 import luan.LuaFunction; |
6 import luan.LuaException; | 5 import luan.LuaException; |
7 import luan.LuaSource; | 6 import luan.LuaSource; |
8 | 7 |
9 | 8 |
14 } | 13 } |
15 | 14 |
16 @Override public Object eval(LuaStateImpl lua) throws LuaException { | 15 @Override public Object eval(LuaStateImpl lua) throws LuaException { |
17 Object o1 = op1.eval(lua); | 16 Object o1 = op1.eval(lua); |
18 Object o2 = op2.eval(lua); | 17 Object o2 = op2.eval(lua); |
19 if( o1 instanceof LuaNumber && o2 instanceof LuaNumber ) { | 18 if( o1 instanceof Number && o2 instanceof Number ) { |
20 LuaNumber n1 = (LuaNumber)o1; | 19 Number n1 = (Number)o1; |
21 LuaNumber n2 = (LuaNumber)o2; | 20 Number n2 = (Number)o2; |
22 return n1.compareTo(n2) <= 0; | 21 return n1.doubleValue() <= n2.doubleValue(); |
23 } | 22 } |
24 if( o1 instanceof String && o2 instanceof String ) { | 23 if( o1 instanceof String && o2 instanceof String ) { |
25 String s1 = (String)o1; | 24 String s1 = (String)o1; |
26 String s2 = (String)o2; | 25 String s2 = (String)o2; |
27 return s1.compareTo(s2) <= 0; | 26 return s1.compareTo(s2) <= 0; |