aboutsummaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index aafdfff..584f386 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -869,7 +869,14 @@ const lua_writestringerror = function() {
for (let i=0; i<arguments.length; i++) {
let a = arguments[i];
if (typeof process === "undefined") {
- console.error(a);
+ /* split along new lines for separate console.error invocations */
+ do {
+ /* regexp uses [\d\D] to work around matching new lines
+ the 's' flag is non-standard */
+ let r = /([^\n]*)\n?([\d\D]*)/.exec(a);
+ console.error(r[1]);
+ a = r[2];
+ } while (a !== "");
} else {
process.stderr.write(a);
}