summaryrefslogtreecommitdiff
path: root/src/ldo.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-05-06 08:11:15 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-05-06 08:16:58 +0200
commit693f073be7408e0eb0422b0e93c60e16b6648045 (patch)
tree7ddcccc9189bd34465fa6b1cbe3ae18fd7209c52 /src/ldo.js
parente9db75fac5f5fb4e8a211f69560151fe4415f9d4 (diff)
downloadfengari-693f073be7408e0eb0422b0e93c60e16b6648045.tar.gz
fengari-693f073be7408e0eb0422b0e93c60e16b6648045.tar.bz2
fengari-693f073be7408e0eb0422b0e93c60e16b6648045.zip
BytecodeParser consumes a MBuffer (== ZIO) instead of a DataView
So we can read binary code with a user reader function
Diffstat (limited to 'src/ldo.js')
-rw-r--r--src/ldo.js4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/ldo.js b/src/ldo.js
index 13bd15c..5865f96 100644
--- a/src/ldo.js
+++ b/src/ldo.js
@@ -574,9 +574,7 @@ const f_parser = function(L, p) {
let c = p.z.getc(); /* read first character */
if (c === defs.LUA_SIGNATURE.charCodeAt(0)) {
checkmode(L, p.mode, defs.to_luastring("binary", true));
- let buff = p.z.buffer;
- if (Array.isArray(buff)) buff = new DataView(new Uint8Array(p.z.buffer).buffer); /* Lua string holding binary (string.dump) */
- cl = new BytecodeParser(L, buff, p.name).luaU_undump();
+ cl = new BytecodeParser(L, p.z, p.name).luaU_undump();
} else {
checkmode(L, p.mode, defs.to_luastring("text", true));
cl = lparser.luaY_parser(L, p.z, p.buff, p.dyd, p.name, c);