aboutsummaryrefslogtreecommitdiffstats
path: root/util/pluginloader.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 /util/pluginloader.lua
parent217e6d011c8d8ae2c44034fc9138925d77c3c10b (diff)
downloadprosody-d49b9bc2abb50b22ae3d6739d96423e9dadfeda8.tar.gz
prosody-d49b9bc2abb50b22ae3d6739d96423e9dadfeda8.zip
Eliminate direct setfenv usage
Diffstat (limited to 'util/pluginloader.lua')
-rw-r--r--util/pluginloader.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/util/pluginloader.lua b/util/pluginloader.lua
index 555e41bf..8b4dbd16 100644
--- a/util/pluginloader.lua
+++ b/util/pluginloader.lua
@@ -16,6 +16,7 @@ end
local io_open, os_time = io.open, os.time;
local loadstring, pairs = loadstring, pairs;
+local envload = require "util.envload".envload;
module "pluginloader"
@@ -48,11 +49,11 @@ function load_resource(plugin, resource)
return load_file(names);
end
-function load_code(plugin, resource)
+function load_code(plugin, resource, env)
local content, err = load_resource(plugin, resource);
if not content then return content, err; end
local path = err;
- local f, err = loadstring(content, "@"..path);
+ local f, err = envload(content, "@"..path, env);
if not f then return f, err; end
return f, path;
end