Software /
code /
prosody
Diff
util/pluginloader.lua @ 6777:5de6b93d0190
util.*: Remove use of module() function, make all module functions local and return them in a table at the end
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Feb 2015 10:36:37 +0100 |
parent | 6031:8796aa94c4b5 |
child | 7115:805d068d2fd5 |
line wrap: on
line diff
--- a/util/pluginloader.lua Mon Aug 10 22:16:05 2015 +0200 +++ b/util/pluginloader.lua Sat Feb 21 10:36:37 2015 +0100 @@ -17,9 +17,7 @@ local io_open = io.open; local envload = require "util.envload".envload; -module "pluginloader" - -function load_file(names) +local function load_file(names) local file, err, path; for i=1,#plugin_dir do for j=1,#names do @@ -35,7 +33,7 @@ return file, err; end -function load_resource(plugin, resource) +local function load_resource(plugin, resource) resource = resource or "mod_"..plugin..".lua"; local names = { @@ -48,7 +46,7 @@ return load_file(names); end -function load_code(plugin, resource, env) +local function load_code(plugin, resource, env) local content, err = load_resource(plugin, resource); if not content then return content, err; end local path = err; @@ -57,4 +55,8 @@ return f, path; end -return _M; +return { + load_file = load_file; + load_resource = load_resource; + load_code = load_code; +};