Software / code / prosody
Comparison
util/pluginloader.lua @ 2325:265441f2ad48
util.pluginloader: Don't specify a host for the plugin data store (clever waqas...)
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 05 Dec 2009 13:34:45 +0000 |
| parent | 2276:d9302be05f86 |
| child | 2925:692b3c6c5bd2 |
comparison
equal
deleted
inserted
replaced
| 2324:9f7eb1054a2f | 2325:265441f2ad48 |
|---|---|
| 15 local datamanager = require "util.datamanager"; | 15 local datamanager = require "util.datamanager"; |
| 16 | 16 |
| 17 module "pluginloader" | 17 module "pluginloader" |
| 18 | 18 |
| 19 local function load_from_datastore(name) | 19 local function load_from_datastore(name) |
| 20 local content = datamanager.load(name, "*", "plugins"); | 20 local content = datamanager.load(name, nil, "plugins"); |
| 21 if not content or not content[1] then return nil, "Resource not found"; end | 21 if not content or not content[1] then return nil, "Resource not found"; end |
| 22 return content[1], name; | 22 return content[1], name; |
| 23 end | 23 end |
| 24 | 24 |
| 25 local function load_file(name) | 25 local function load_file(name) |
| 55 if metadata then | 55 if metadata then |
| 56 for k,v in pairs(metadata) do | 56 for k,v in pairs(metadata) do |
| 57 store[k] = v; | 57 store[k] = v; |
| 58 end | 58 end |
| 59 end | 59 end |
| 60 datamanager.store(plugin.."/"..resource, "*", "plugins", store); | 60 datamanager.store(plugin.."/"..resource, nil, "plugins", store); |
| 61 end | 61 end |
| 62 | 62 |
| 63 function load_code(plugin, resource) | 63 function load_code(plugin, resource) |
| 64 local content, err = load_resource(plugin, resource); | 64 local content, err = load_resource(plugin, resource); |
| 65 if not content then return content, err; end | 65 if not content then return content, err; end |