From eae1d1afb8108d8c642621ffd21f228779a1d792 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sat, 6 Jan 2018 22:07:51 +1100 Subject: src/ltablib.js: Pass length to luaL_addlstring --- src/ltablib.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ltablib.js b/src/ltablib.js index 70ff595..9998f3c 100644 --- a/src/ltablib.js +++ b/src/ltablib.js @@ -131,6 +131,7 @@ const tmove = function(L) { const tconcat = function(L) { let last = aux_getn(L, 1, TAB_R); let sep = lauxlib.luaL_optlstring(L, 2, lua.to_luastring("")); + let lsep = sep.length; let i = lauxlib.luaL_optinteger(L, 3, 1); last = lauxlib.luaL_optinteger(L, 4, last); @@ -139,7 +140,7 @@ const tconcat = function(L) { for (; i < last; i++) { addfield(L, b, i); - lauxlib.luaL_addlstring(b, sep); + lauxlib.luaL_addlstring(b, sep, lsep); } if (i === last) -- cgit v1.2.3-70-g09d2