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
commit40ea2230d1d494c55d8a2b22e111c4bd29074974 (patch)
tree28c1bcbab960b28cc27f30e8ab0c04e30f11da2d /util/pluginloader.lua
parentad7ee8604f2811d3ca3e5adb5faa8c095f4d5999 (diff)
downloadprosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.tar.gz
prosody-40ea2230d1d494c55d8a2b22e111c4bd29074974.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