summaryrefslogtreecommitdiff
path: root/src/lapi.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-11 17:05:27 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-11 17:05:27 +1100
commitf28c4fb81f2de81470a739be1bc15e5158d10de0 (patch)
tree4bd1c668ca750bc672e08221c492f2f55273b5d8 /src/lapi.js
parent0b6489358c3971efa5ad7d05f7532d31029049ea (diff)
downloadfengari-f28c4fb81f2de81470a739be1bc15e5158d10de0.tar.gz
fengari-f28c4fb81f2de81470a739be1bc15e5158d10de0.tar.bz2
fengari-f28c4fb81f2de81470a739be1bc15e5158d10de0.zip
src/lapi.js: Factor out default chunkname
Diffstat (limited to 'src/lapi.js')
-rw-r--r--src/lapi.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lapi.js b/src/lapi.js
index 0c1a3a6..c1952dd 100644
--- a/src/lapi.js
+++ b/src/lapi.js
@@ -914,8 +914,9 @@ const lua_arith = function(L, op) {
** 'load' and 'call' functions (run Lua code)
*/
+const default_chunkname = defs.to_luastring("?");
const lua_load = function(L, reader, data, chunkname, mode) {
- if (!chunkname) chunkname = [defs.char["?"]];
+ if (!chunkname) chunkname = default_chunkname;
else assert(defs.is_luastring(chunkname), "lua_load expect an array of byte as chunkname");
assert(mode ? defs.is_luastring(mode) : true, "lua_load expect an array of byte as mode");
let z = new lzio.ZIO(L, reader, data);