aboutsummaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-11-12 17:00:01 +1100
committerdaurnimator <quae@daurnimator.com>2017-11-12 20:33:14 +1100
commit71902632f1de46d70ee0280fc464d05013b98b28 (patch)
treeea99f8efaf27030b65197f26d0352e47444fa9c7 /src/lauxlib.js
parentd8caec5b1dc33cc3a89a1995b0e1a30ba0301184 (diff)
downloadfengari-71902632f1de46d70ee0280fc464d05013b98b28.tar.gz
fengari-71902632f1de46d70ee0280fc464d05013b98b28.tar.bz2
fengari-71902632f1de46d70ee0280fc464d05013b98b28.zip
lua_writestringerror now takes a vararg and converts arrays
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index 3808c7e..24d2203 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -853,11 +853,18 @@ const luaL_dofile = function(L, filename) {
return (luaL_loadfile(L, filename) || lua.lua_pcall(L, 0, lua.LUA_MULTRET, 0));
};
-const lua_writestringerror = function(s) {
- if (WEB) {
- process.stderr.write(s);
- } else {
- console.error(s);
+const lua_writestringerror = function() {
+ for (let i=0; i<arguments.length; i++) {
+ let a = arguments[i];
+ if (WEB) {
+ if (typeof a !== "string")
+ a = lua.to_jsstring(a);
+ console.error(a);
+ } else {
+ if (typeof a !== "string")
+ a = Uint8Array.from(a);
+ process.stderr.write(a);
+ }
}
};