summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lbaselib.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lbaselib.js b/src/lbaselib.js
index dfd39bb..5a17aa8 100644
--- a/src/lbaselib.js
+++ b/src/lbaselib.js
@@ -21,8 +21,10 @@ const luaB_print = function(L) {
}
// Don't use console.log if Node
- if (process.stdout) process.stdout.write(lua.to_jsstring(str) + "\n");
- else console.log(lua.to_jsstring(str));
+ if (process.stdout) {
+ str.push("\n".charCodeAt(0));
+ process.stdout.write(Buffer.from(str));
+ } else console.log(lua.to_jsstring(str));
return 0;
};