summaryrefslogtreecommitdiff
path: root/src/lbaselib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-29 16:37:58 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-29 16:42:09 +1000
commit32b88f3eb447450f0db3c089f89d895f64ff3202 (patch)
treed06dcaf565c52845c0166e9b6feb4bccc71dda8c /src/lbaselib.js
parentc1495c926824deb9628b5e912e1c36a9980bef28 (diff)
downloadfengari-32b88f3eb447450f0db3c089f89d895f64ff3202.tar.gz
fengari-32b88f3eb447450f0db3c089f89d895f64ff3202.tar.bz2
fengari-32b88f3eb447450f0db3c089f89d895f64ff3202.zip
src/lbaselib.js: Make print() correctly handle 8bit chars under node
Diffstat (limited to 'src/lbaselib.js')
-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;
};