summaryrefslogtreecommitdiff
path: root/src/lauxlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-10 01:01:43 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-10 01:07:58 +1100
commit382bfe27205d5ade172fa088fcab0b2e123838e4 (patch)
tree394e24f93123e3efe75c8ef0d56007e8934e1c53 /src/lauxlib.js
parent4d8bd2b823eddada773a84e4004c380cf7de8762 (diff)
downloadfengari-382bfe27205d5ade172fa088fcab0b2e123838e4.tar.gz
fengari-382bfe27205d5ade172fa088fcab0b2e123838e4.tar.bz2
fengari-382bfe27205d5ade172fa088fcab0b2e123838e4.zip
Use `typeof process === "undefined"` instead of WEB global
This removes requirement to set global.WEB before requiring in node
Diffstat (limited to 'src/lauxlib.js')
-rw-r--r--src/lauxlib.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lauxlib.js b/src/lauxlib.js
index d976cee..f95f9a8 100644
--- a/src/lauxlib.js
+++ b/src/lauxlib.js
@@ -708,13 +708,13 @@ class LoadF {
constructor() {
this.n = NaN; /* number of pre-read characters */
this.f = null; /* file being read */
- this.buff = WEB ? new Array(1024) : new Buffer(1024); /* area for reading file */
+ this.buff = typeof process === "undefined" ? new Array(1024) : new Buffer(1024); /* area for reading file */
this.pos = 0; /* current position in file */
this.err = void 0;
}
}
-if (WEB) {
+if (typeof process === "undefined") {
const getF = function(L, ud) {
let lf = ud;
@@ -858,7 +858,7 @@ const luaL_dofile = function(L, filename) {
const lua_writestringerror = function() {
for (let i=0; i<arguments.length; i++) {
let a = arguments[i];
- if (WEB) {
+ if (typeof process === "undefined") {
if (typeof a !== "string")
a = lua.to_jsstring(a);
console.error(a);