summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lstrlib.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lstrlib.js b/src/lstrlib.js
index c22474f..f48d859 100644
--- a/src/lstrlib.js
+++ b/src/lstrlib.js
@@ -617,7 +617,7 @@ const str_pack = function(L) {
case KOption.Kzstr: { /* zero-terminated string */
let s = lauxlib.luaL_checkstring(L, arg);
let len = s.length;
- lauxlib.luaL_argcheck(L, s.length === String.fromCharCode(...s).length, arg, lua.to_luastring("strings contains zeros", true));
+ lauxlib.luaL_argcheck(L, s.indexOf(0) < 0, arg, lua.to_luastring("strings contains zeros", true));
b.push(...s);
b.push(0); /* add zero at the end */
totalsize += len + 1;