From 6ffe07fc5d16ee9acdcd6651d433ce13b193cd15 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 7 Jan 2018 02:07:17 +1100 Subject: TypedArray.toString() doesn't return a unique string in some browsers e.g. IE11 Instead iterate over string contents and manually build hash. I have *not* tested this for performance. An alternative option is to use Array.prototype.join.call --- src/lstring.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/lstring.js') diff --git a/src/lstring.js b/src/lstring.js index 84754f0..d65fc6a 100644 --- a/src/lstring.js +++ b/src/lstring.js @@ -31,7 +31,11 @@ const luaS_eqlngstr = function(a, b) { make sure this doesn't conflict with any of the anti-collision strategies in ltable */ const luaS_hash = function(str) { assert(defs.is_luastring(str)); - return '|'+str.toString(); + let len = str.length; + let s = "|"; + for (let i=0; i