From fbdcb3e7172e31346d66dc8c4385a2d43c40a58a Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 27 Sep 2017 22:45:32 +1000 Subject: src/loadlib.js: Pass fengari library to JS modules --- src/loadlib.js | 5 +++-- 1 file 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}`)); -- cgit v1.2.3-70-g09d2