summaryrefslogtreecommitdiff
path: root/src/defs.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/defs.js
parent6099ba186c38c854332ec483edd6cbca3cf94871 (diff)
parent8249248f80467f1660509a30623f40bb9ff1eba7 (diff)
downloadfengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.gz
fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.tar.bz2
fengari-e0e5d05626fcd6cb4622abcaae9fc951d9ae91b1.zip
Merge branch 'Uint8Array'
Diffstat (limited to 'src/defs.js')
-rw-r--r--src/defs.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/defs.js b/src/defs.js
index 27498c6..381114b 100644
--- a/src/defs.js
+++ b/src/defs.js
@@ -131,10 +131,10 @@ class lua_Debug {
}
-const string_of = Array.of;
+const string_of = Uint8Array.of.bind(Uint8Array);
const is_luastring = function(s) {
- return Array.isArray(s);
+ return s instanceof Uint8Array;
};
/* test two lua strings for equality */
@@ -143,7 +143,7 @@ const luastring_cmp = function(a, b) {
};
const to_jsstring = function(value, from, to) {
- assert(is_luastring(value), "jsstring expects an array of bytes");
+ assert(is_luastring(value), "jsstring expects a Uint8Array");
if (to === void 0) {
to = value.length;
@@ -240,6 +240,7 @@ const to_luastring = function(str, cache) {
outU8Array[outIdx++] = 0x80 | (u & 63);
}
}
+ outU8Array = Uint8Array.from(outU8Array);
if (cache) to_luastring_cache[str] = outU8Array;