From 382bfe27205d5ade172fa088fcab0b2e123838e4 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Sun, 10 Dec 2017 01:01:43 +1100 Subject: Use `typeof process === "undefined"` instead of WEB global This removes requirement to set global.WEB before requiring in node --- src/lauxlib.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/lauxlib.js') 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