summaryrefslogtreecommitdiff
path: root/src/loadlib.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/loadlib.js')
-rw-r--r--src/loadlib.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/loadlib.js b/src/loadlib.js
index dbd5c3c..cae377f 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -36,7 +36,7 @@ const AUXMARK = [1];
** error string in the stack.
*/
let lsys_load;
-if (WEB) {
+if (typeof process === "undefined") {
lsys_load = function(L, path, seeglb) {
path = lua.to_uristring(path);
let xhr = new XMLHttpRequest();
@@ -111,9 +111,7 @@ const noenv = function(L) {
};
let readable;
-// Only with Node
-if (!WEB) {
-
+if (typeof process !== "undefined") { // Only with Node
const fs = require('fs');
readable = function(filename) {
@@ -189,7 +187,7 @@ const ll_loadlib = function(L) {
};
let env;
-if (WEB) {
+if (typeof process === "undefined") {
env = window;
} else {
env = process.env;
@@ -304,7 +302,7 @@ const checkload = function(L, stat, filename) {
return 2; /* return open function and file name */
} else
return lauxlib.luaL_error(L, lua.to_luastring("error loading module '%s' from file '%s':\n\t%s"),
- lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1));
+ lua.lua_tostring(L, 1), filename, lua.lua_tostring(L, -1));
};
const searcher_Lua = function(L) {