summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-09-27 22:45:32 +1000
committerdaurnimator <quae@daurnimator.com>2017-09-27 22:45:32 +1000
commitfbdcb3e7172e31346d66dc8c4385a2d43c40a58a (patch)
treea92a942b355211203e85add0957e9b10893942b3
parent98ca74b0d55cef6a019612057b842e71f82435f6 (diff)
downloadfengari-fbdcb3e7172e31346d66dc8c4385a2d43c40a58a.tar.gz
fengari-fbdcb3e7172e31346d66dc8c4385a2d43c40a58a.tar.bz2
fengari-fbdcb3e7172e31346d66dc8c4385a2d43c40a58a.zip
src/loadlib.js: Pass fengari library to JS modules
-rw-r--r--src/loadlib.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/loadlib.js b/src/loadlib.js
index 51e0279..a7b27af 100644
--- a/src/loadlib.js
+++ b/src/loadlib.js
@@ -1,5 +1,6 @@
"use strict";
+const fengari = require('./fengari.js');
const lua = require('./lua.js');
const lauxlib = require('./lauxlib.js');
@@ -44,12 +45,12 @@ if (WEB) {
if (xhr.status >= 200 && xhr.status <= 299) {
let func;
try {
- func = Function(xhr.response);
+ func = Function("fengari", xhr.response);
} catch (e) {
lua.lua_pushstring(L, lua.to_luastring(`${e.name}: ${e.message}`));
return null;
}
- let res = func();
+ let res = func(fengari);
return res;
} else {
lua.lua_pushstring(L, lua.to_luastring(`${xhr.status}: ${xhr.statusText}`));