Software /
code /
prosody
Diff
util/pluginloader.lua @ 5021:85b2689dbcfe
Eliminate direct setfenv usage
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Fri, 08 Jun 2012 05:04:38 +0200 |
parent | 4154:3785a9bb7f11 |
child | 5072:586c9106a106 |
line wrap: on
line diff
--- a/util/pluginloader.lua Thu Jun 07 23:27:26 2012 +0200 +++ b/util/pluginloader.lua Fri Jun 08 05:04:38 2012 +0200 @@ -16,6 +16,7 @@ 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 @@ 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