aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.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
commit40ea2230d1d494c55d8a2b22e111c4bd29074974 (patch)
tree28c1bcbab960b28cc27f30e8ab0c04e30f11da2d /core/configmanager.lua
parentad7ee8604f2811d3ca3e5adb5faa8c095f4d5999 (diff)
downloadprosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.tar.gz
prosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.zip
Eliminate direct setfenv usage
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index e2253171..8fea3be5 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -13,6 +13,7 @@ local format, math_max = string.format, math.max;
local fire_event = prosody and prosody.events.fire_event or function () end;
+local envload = require"util.envload".envload;
local lfs = require "lfs";
local path_sep = package.config:sub(1,1);
@@ -164,8 +165,8 @@ end
-- Built-in Lua parser
do
- local loadstring, pcall, setmetatable = _G.loadstring, _G.pcall, _G.setmetatable;
- local setfenv, rawget, tostring = _G.setfenv, _G.rawget, _G.tostring;
+ local pcall, setmetatable = _G.pcall, _G.setmetatable;
+ local rawget, tostring = _G.rawget, _G.tostring;
parsers.lua = {};
function parsers.lua.load(data, config_file, config)
local env;
@@ -263,14 +264,12 @@ do
return dofile(resolve_relative_path(config_file:gsub("[^"..path_sep.."]+$", ""), file));
end
- local chunk, err = loadstring(data, "@"..config_file);
+ local chunk, err = envload(data, "@"..config_file, env);
if not chunk then
return nil, err;
end
- setfenv(chunk, env);
-
local ok, err = pcall(chunk);
if not ok then