Mercurial Hosting > luan
comparison core/src/luan/impl/EqExpr.java @ 404:d55e873e1f0d
metatables now only apply to tables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 29 Apr 2015 07:04:40 -0600 |
parents | 17b02b56d806 |
children | 23a93c118042 |
comparison
equal
deleted
inserted
replaced
403:637f7ad85654 | 404:d55e873e1f0d |
---|---|
32 if( o1 instanceof byte[] && o2 instanceof byte[] ) { | 32 if( o1 instanceof byte[] && o2 instanceof byte[] ) { |
33 byte[] b1 = (byte[])o1; | 33 byte[] b1 = (byte[])o1; |
34 byte[] b2 = (byte[])o2; | 34 byte[] b2 = (byte[])o2; |
35 return Arrays.equals(b1,b2); | 35 return Arrays.equals(b1,b2); |
36 } | 36 } |
37 if( o1==null || o2==null || !o1.getClass().equals(o2.getClass()) ) | 37 if( !(o1 instanceof LuanTable && o2 instanceof LuanTable) ) |
38 return false; | 38 return false; |
39 LuanTable mt1 = luan.getMetatable(o1); | 39 LuanTable t1 = (LuanTable)o1; |
40 LuanTable mt2 = luan.getMetatable(o2); | 40 LuanTable t2 = (LuanTable)o2; |
41 LuanTable mt1 = t1.getMetatable(); | |
42 LuanTable mt2 = t2.getMetatable(); | |
41 if( mt1==null || mt2==null ) | 43 if( mt1==null || mt2==null ) |
42 return false; | 44 return false; |
43 Object f = mt1.get("__eq"); | 45 Object f = mt1.get("__eq"); |
44 if( f == null || !f.equals(mt2.get("__eq")) ) | 46 if( f == null || !f.equals(mt2.get("__eq")) ) |
45 return false; | 47 return false; |