aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-06-16 11:38:20 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-06-16 11:38:20 +0200
commit0414d1fe801059d09d3cdd7df777438c4d2e0e83 (patch)
tree288658111f66c21cfbea3f57fb9a71e99a854c6b /src
parentc59ef784df550312fd452dfb7faa16a386602566 (diff)
downloadfengari-0414d1fe801059d09d3cdd7df777438c4d2e0e83.tar.gz
fengari-0414d1fe801059d09d3cdd7df777438c4d2e0e83.tar.bz2
fengari-0414d1fe801059d09d3cdd7df777438c4d2e0e83.zip
packint: Fixed how we search for 0 in Kzstr
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;