changeset 1214:bae51e2d34c9

fix binary hash_code
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 19 Mar 2018 16:55:05 -0600
parents d5d5d29d7592
children d2da8bfa2013
files src/luan/modules/BasicLuan.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java	Wed Mar 14 18:50:18 2018 -0600
+++ b/src/luan/modules/BasicLuan.java	Mon Mar 19 16:55:05 2018 -0600
@@ -7,6 +7,7 @@
 import java.util.Map;
 import java.util.List;
 import java.util.ArrayList;
+import java.util.Arrays;
 import luan.Luan;
 import luan.LuanState;
 import luan.LuanTable;
@@ -219,6 +220,8 @@
 	public static int hash_code(Object obj) throws LuanException {
 		if( obj == null ) {
 			return 0;
+		} else if( obj instanceof byte[] ) {
+			return Arrays.hashCode((byte[])obj);
 		} else {
 			return obj.hashCode();
 		}