aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/llex.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/llex.js b/src/llex.js
index 4f5b97e..9983c1d 100644
--- a/src/llex.js
+++ b/src/llex.js
@@ -480,11 +480,13 @@ const read_string = function(ls, del, seminfo) {
}
}
save_and_next(ls); /* skip delimiter */
+
seminfo.ts = new TValue(
CT.LUA_TLNGSTR,
- lua.to_luastring(
- ls.buff.buffer.slice(1, ls.buff.buffer.length-1).join('')
- )
+ ls.buff.buffer
+ .slice(1, ls.buff.n-1)
+ .map(e => typeof e === "string" ? lua.to_luastring(e) : [e])
+ .reduce((acc, e) => acc = acc.concat(e), []) /* Hex value must not be converted */
);
};
@@ -641,4 +643,4 @@ module.exports.luaX_next = luaX_next;
module.exports.luaX_setinput = luaX_setinput;
module.exports.luaX_syntaxerror = luaX_syntaxerror;
module.exports.luaX_token2str = luaX_token2str;
-module.exports.luaX_tokens = luaX_tokens; \ No newline at end of file
+module.exports.luaX_tokens = luaX_tokens;