2 local plugin_dir = CFG_PLUGINDIR or "./plugins/";
4 local io_open = io.open;
5 local loadstring = loadstring;
9 local function load_file(name)
10 local file, err = io_open(plugin_dir..name);
11 if not file then return file, err; end
12 local content = file:read("*a");
17 function load_resource(plugin, resource)
19 resource = "mod_"..plugin..".lua";
21 local content, err = load_file(plugin.."/"..resource);
22 if not content then content, err = load_file(resource); end
23 -- TODO add support for packed plugins
27 function load_code(plugin, resource)
28 local content, err = load_resource(plugin, resource);
29 if not content then return content, err; end
30 return loadstring(content, "@"..err);