diff options
author | Florian Zeitz <florob@babelmonkeys.de> | 2012-06-08 05:04:38 +0200 |
---|---|---|
committer | Florian Zeitz <florob@babelmonkeys.de> | 2012-06-08 05:04:38 +0200 |
commit | 40ea2230d1d494c55d8a2b22e111c4bd29074974 (patch) | |
tree | 28c1bcbab960b28cc27f30e8ab0c04e30f11da2d /core/moduleapi.lua | |
parent | ad7ee8604f2811d3ca3e5adb5faa8c095f4d5999 (diff) | |
download | prosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.tar.gz prosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.zip |
Eliminate direct setfenv usage
Diffstat (limited to 'core/moduleapi.lua')
-rw-r--r-- | core/moduleapi.lua | 7 |
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 |