Mercurial > prosody-hg
comparison core/configmanager.lua @ 857:49298263f241
core.configmanager: Small fix to check validity of Component definitions
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 03 Mar 2009 16:54:29 +0000 |
| parents | e27a48e35bbb |
| children | 2c0b9e3c11c3 |
comparison
equal
deleted
inserted
replaced
| 856:946d0f91bd38 | 857:49298263f241 |
|---|---|
| 7 -- | 7 -- |
| 8 | 8 |
| 9 | 9 |
| 10 | 10 |
| 11 local _G = _G; | 11 local _G = _G; |
| 12 local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile = | 12 local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type = |
| 13 setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile; | 13 setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type; |
| 14 | 14 |
| 15 module "configmanager" | 15 module "configmanager" |
| 16 | 16 |
| 17 local parsers = {}; | 17 local parsers = {}; |
| 18 | 18 |
| 115 end | 115 end |
| 116 env.host = env.Host; | 116 env.host = env.Host; |
| 117 | 117 |
| 118 function env.Component(name) | 118 function env.Component(name) |
| 119 return function (module) | 119 return function (module) |
| 120 set(name, "core", "component_module", module); | 120 if type(module) == "string" then |
| 121 -- Don't load the global modules by default | 121 set(name, "core", "component_module", module); |
| 122 set(name, "core", "modules_enable", false); | 122 -- Don't load the global modules by default |
| 123 rawset(env, "__currenthost", name); | 123 set(name, "core", "modules_enable", false); |
| 124 rawset(env, "__currenthost", name); | |
| 125 end | |
| 124 end | 126 end |
| 125 end | 127 end |
| 126 env.component = env.Component; | 128 env.component = env.Component; |
| 127 | 129 |
| 128 function env.Include(file) | 130 function env.Include(file) |
