summaryrefslogtreecommitdiff
path: root/src/lobject.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lobject.js')
-rw-r--r--src/lobject.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lobject.js b/src/lobject.js
index e69a9ef..91078ed 100644
--- a/src/lobject.js
+++ b/src/lobject.js
@@ -526,6 +526,12 @@ const luaO_pushvfstring = function(L, fmt, argp) {
case char['s']: {
let s = argp[a++];
if (s === null) s = defs.to_luastring("(null)", true);
+ else {
+ /* respect null terminator */
+ let i = s.indexOf(0);
+ if (i !== -1)
+ s = s.slice(0, i);
+ }
pushstr(L, s);
break;
}