Mercurial Hosting > luan
comparison src/luan/interp/EqExpr.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.LuaTable; | 5 import luan.LuaTable; |
7 import luan.LuaException; | 6 import luan.LuaException; |
8 import luan.LuaSource; | 7 import luan.LuaSource; |
9 | 8 |
17 @Override public Object eval(LuaStateImpl lua) throws LuaException { | 16 @Override public Object eval(LuaStateImpl lua) throws LuaException { |
18 Object o1 = op1.eval(lua); | 17 Object o1 = op1.eval(lua); |
19 Object o2 = op2.eval(lua); | 18 Object o2 = op2.eval(lua); |
20 if( o1 == o2 || o1 != null && o1.equals(o2) ) | 19 if( o1 == o2 || o1 != null && o1.equals(o2) ) |
21 return true; | 20 return true; |
21 if( o1 instanceof Number && o2 instanceof Number ) { | |
22 Number n1 = (Number)o1; | |
23 Number n2 = (Number)o2; | |
24 return n1.doubleValue() == n2.doubleValue(); | |
25 } | |
22 if( !o1.getClass().equals(o2.getClass()) ) | 26 if( !o1.getClass().equals(o2.getClass()) ) |
23 return false; | 27 return false; |
24 LuaTable mt1 = lua.getMetatable(o1); | 28 LuaTable mt1 = lua.getMetatable(o1); |
25 LuaTable mt2 = lua.getMetatable(o2); | 29 LuaTable mt2 = lua.getMetatable(o2); |
26 if( mt1==null || mt2==null ) | 30 if( mt1==null || mt2==null ) |