summaryrefslogtreecommitdiff
path: root/src/lua.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-12 16:48:53 +0100
committerBenoit Giannangeli <giann@users.noreply.github.com>2017-03-13 11:03:24 +0100
commit2a6993bf0e23e2a3759abb9d7127525577dc346c (patch)
tree2b605f78ee91ca242770c1573d1c2138677fd66b /src/lua.js
parent4c404c404c281f1872f0283acbaee97657f3e08b (diff)
downloadfengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.tar.gz
fengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.tar.bz2
fengari-2a6993bf0e23e2a3759abb9d7127525577dc346c.zip
Testing 8-bit strings
Diffstat (limited to 'src/lua.js')
-rw-r--r--src/lua.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lua.js b/src/lua.js
index 12d4e65..08bad58 100644
--- a/src/lua.js
+++ b/src/lua.js
@@ -133,8 +133,8 @@ class lua_Debug {
}
const to_luastring = function(str, maxBytesToWrite) {
- maxBytesToWrite = maxBytesToWrite !== undefined ? maxBytesToWrite : str.length;
- let outU8Array = new Array(maxBytesToWrite);
+ maxBytesToWrite = maxBytesToWrite !== undefined ? maxBytesToWrite : str.length + 1;
+ let outU8Array = [];
if (!(maxBytesToWrite > 0)) // Parameter maxBytesToWrite is not optional. Negative values, 0, null, undefined and false each don't write out any bytes.
return 0;
@@ -184,7 +184,7 @@ const to_luastring = function(str, maxBytesToWrite) {
}
}
// Null-terminate the pointer to the buffer.
- outU8Array[outIdx] = 0;
+ // outU8Array[outIdx] = 0;
return outU8Array;
};