util.events: Add local reference to table.remove (fixes traceback)
[prosody.git] / util / pluginloader.lua
index cec8a3f62ef7af521850db7969cddca663f8b855..b9b3e207fa685ffbf38dbc4f474567fd7a81f6a8 100644 (file)
@@ -1,7 +1,7 @@
 -- Prosody IM
 -- Copyright (C) 2008-2010 Matthew Wild
 -- Copyright (C) 2008-2010 Waqas Hussain
--- 
+--
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
 --
@@ -14,8 +14,7 @@ for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^"..
        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"
@@ -40,10 +39,10 @@ function load_resource(plugin, resource)
        resource = resource or "mod_"..plugin..".lua";
 
        local names = {
-               "mod_"..plugin.."/"..plugin.."/"..resource; -- mod_hello/hello/mod_hello.lua
-               "mod_"..plugin.."/"..resource;              -- mod_hello/mod_hello.lua
-               plugin.."/"..resource;                      -- hello/mod_hello.lua
-               resource;                                   -- mod_hello.lua
+               "mod_"..plugin..dir_sep..plugin..dir_sep..resource; -- mod_hello/hello/mod_hello.lua
+               "mod_"..plugin..dir_sep..resource;                  -- mod_hello/mod_hello.lua
+               plugin..dir_sep..resource;                          -- hello/mod_hello.lua
+               resource;                                           -- mod_hello.lua
        };
 
        return load_file(names);