aboutsummaryrefslogtreecommitdiffstats
path: root/core/moduleapi.lua
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2012-06-08 05:04:38 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2012-06-08 05:04:38 +0200
commitd49b9bc2abb50b22ae3d6739d96423e9dadfeda8 (patch)
tree28c1bcbab960b28cc27f30e8ab0c04e30f11da2d /core/moduleapi.lua
parent217e6d011c8d8ae2c44034fc9138925d77c3c10b (diff)
downloadprosody-d49b9bc2abb50b22ae3d6739d96423e9dadfeda8.tar.gz
prosody-d49b9bc2abb50b22ae3d6739d96423e9dadfeda8.zip
Eliminate direct setfenv usage
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r--core/moduleapi.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 24d29dfe..2bcf9b84 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -17,7 +17,7 @@ local timer = require "util.timer";
local multitable_new = require "util.multitable".new;
local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
-local error, setmetatable, setfenv, type = error, setmetatable, setfenv, type;
+local error, setmetatable, type = error, setmetatable, type;
local ipairs, pairs, select, unpack = ipairs, pairs, select, unpack;
local tonumber, tostring = tonumber, tostring;
@@ -99,12 +99,11 @@ end
api.hook_stanza = api.hook_tag; -- COMPAT w/pre-0.9
function api:require(lib)
- local f, n = pluginloader.load_code(self.name, lib..".lib.lua");
+ local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment);
if not f then
- f, n = pluginloader.load_code(lib, lib..".lib.lua");
+ f, n = pluginloader.load_code(lib, lib..".lib.lua", self.environment);
end
if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message
- setfenv(f, self.environment);
return f();
end