diff options
-rw-r--r-- | src/lbaselib.js | 2 | ||||
-rw-r--r-- | tests/test-suite/calls.js | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js index 5e3fff6..d1d930a 100644 --- a/src/lbaselib.js +++ b/src/lbaselib.js @@ -297,7 +297,7 @@ const luaB_load = function(L) { let status; if (s !== null) { /* loading a string? */ let chunkname = lauxlib.luaL_optstring(L, 2, s); - status = lauxlib.luaL_loadbufferx(L, s, chunkname, mode); + status = lauxlib.luaL_loadbufferx(L, s, s.length, chunkname, mode); } else { /* loading from a reader function */ let chunkname = lauxlib.luaL_optstring(L, 2, lua.to_luastring("=(load)", true)); lauxlib.luaL_checktype(L, 1, lua.LUA_TFUNCTION); diff --git a/tests/test-suite/calls.js b/tests/test-suite/calls.js index 08e72cc..f7ea559 100644 --- a/tests/test-suite/calls.js +++ b/tests/test-suite/calls.js @@ -392,8 +392,8 @@ test("[test-suite] calls: test for generic load", function (t) { assert(a() == "\0" and _G.x == 33) assert(debug.getinfo(a).source == "modname") -- cannot read text in binary mode - -- cannotload("attempt to load a text chunk", load(read1(x), "modname", "b", {})) - -- cannotload("attempt to load a text chunk", load(x, "modname", "b")) + cannotload("attempt to load a text chunk", load(read1(x), "modname", "b", {})) + cannotload("attempt to load a text chunk", load(x, "modname", "b")) a = assert(load(function () return nil end)) a() -- empty chunk |