Mercurial Hosting > luan
changeset 363:17b02b56d806
fix LuanPropertyTable.asMap();
fix binary==binary;
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 16 Apr 2015 10:12:58 -0600 |
parents | 9dbf3433f70f |
children | 1a464e090538 |
files | core/src/luan/LuanPropertyTable.java core/src/luan/impl/EqExpr.java |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r 9dbf3433f70f -r 17b02b56d806 core/src/luan/LuanPropertyTable.java --- a/core/src/luan/LuanPropertyTable.java Wed Apr 15 20:33:47 2015 -0600 +++ b/core/src/luan/LuanPropertyTable.java Thu Apr 16 10:12:58 2015 -0600 @@ -55,4 +55,12 @@ }; } + @Override public Map<Object,Object> asMap() { + Map<Object,Object> map = newMap(); + for( Map.Entry<Object,Object> entry : this ) { + map.put(entry.getKey(),entry.getValue()); + } + return map; + } + }
diff -r 9dbf3433f70f -r 17b02b56d806 core/src/luan/impl/EqExpr.java --- a/core/src/luan/impl/EqExpr.java Wed Apr 15 20:33:47 2015 -0600 +++ b/core/src/luan/impl/EqExpr.java Thu Apr 16 10:12:58 2015 -0600 @@ -1,5 +1,6 @@ package luan.impl; +import java.util.Arrays; import luan.Luan; import luan.LuanFunction; import luan.LuanTable; @@ -28,6 +29,11 @@ Number n2 = (Number)o2; return n1.doubleValue() == n2.doubleValue(); } + if( o1 instanceof byte[] && o2 instanceof byte[] ) { + byte[] b1 = (byte[])o1; + byte[] b2 = (byte[])o2; + return Arrays.equals(b1,b2); + } if( o1==null || o2==null || !o1.getClass().equals(o2.getClass()) ) return false; LuanTable mt1 = luan.getMetatable(o1);