From 2a6993bf0e23e2a3759abb9d7127525577dc346c Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Sun, 12 Mar 2017 16:48:53 +0100 Subject: Testing 8-bit strings --- src/lua.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lua.js') 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; }; -- cgit v1.2.3-70-g09d2