projects
/
prosody.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mod_s2s: Detect TLS compression
[prosody.git]
/
util
/
pluginloader.lua
diff --git
a/util/pluginloader.lua
b/util/pluginloader.lua
index 555e41bf82b176ab001a4b5d07d6a3c60e3b1457..c10fdf6525ae2e34868a5bf8bf90c3104664d920 100644
(file)
--- a/
util/pluginloader.lua
+++ b/
util/pluginloader.lua
@@
-14,12
+14,12
@@
for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^"..
plugin_dir[#plugin_dir + 1] = path;
end
plugin_dir[#plugin_dir + 1] = path;
end
-local io_open
, os_time = io.open, os.time
;
-local
loadstring, pairs = loadstring, pairs
;
+local io_open
= io.open
;
+local
envload = require "util.envload".envload
;
module "pluginloader"
module "pluginloader"
-
local
function load_file(names)
+function load_file(names)
local file, err, path;
for i=1,#plugin_dir do
for j=1,#names do
local file, err, path;
for i=1,#plugin_dir do
for j=1,#names do
@@
-48,11
+48,11
@@
function load_resource(plugin, resource)
return load_file(names);
end
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 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
if not f then return f, err; end
return f, path;
end