summaryrefslogtreecommitdiff
path: root/src/lstring.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-15 14:57:13 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-15 14:57:13 +1100
commite0e5d05626fcd6cb4622abcaae9fc951d9ae91b1 (patch)
tree49531b2a69c166ad193adddf50edbadb5e1a91a1 /src/lstring.js
parent6099ba186c38c854332ec483edd6cbca3cf94871 (diff)
parent8249248f80467f1660509a30623f40bb9ff1eba7 (diff)
downloadfengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.gz
fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.bz2
fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.zip
Merge branch 'Uint8Array'
Diffstat (limited to 'src/lstring.js')
-rw-r--r--src/lstring.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lstring.js b/src/lstring.js
index c85e5b2..c8da56a 100644
--- a/src/lstring.js
+++ b/src/lstring.js
@@ -31,7 +31,7 @@ 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.map(e => `${e}|`).join('');
+ return '|'+str.join('|');
};
const luaS_hashlongstr = function(ts) {
@@ -44,12 +44,13 @@ const luaS_hashlongstr = function(ts) {
/* variant that takes ownership of array */
const luaS_bless = function(L, str) {
+ assert(str instanceof Uint8Array);
return new TString(L, str);
};
/* makes a copy */
const luaS_new = function(L, str) {
- return luaS_bless(L, str.slice(0));
+ return luaS_bless(L, Uint8Array.from(str));
};
/* takes a js string */