Software /
code /
prosody
Comparison
core/configmanager.lua @ 2975:c1a2e210f47e
configmanager: Fix very wacky indentation
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 04 May 2010 23:11:41 +0100 |
parent | 2974:f37dc6f038f3 |
child | 2985:fde53d82fde0 |
comparison
equal
deleted
inserted
replaced
2974:f37dc6f038f3 | 2975:c1a2e210f47e |
---|---|
111 local setfenv, rawget, tostring = _G.setfenv, _G.rawget, _G.tostring; | 111 local setfenv, rawget, tostring = _G.setfenv, _G.rawget, _G.tostring; |
112 parsers.lua = {}; | 112 parsers.lua = {}; |
113 function parsers.lua.load(data, filename) | 113 function parsers.lua.load(data, filename) |
114 local env; | 114 local env; |
115 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below | 115 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below |
116 env = setmetatable({ Host = true; host = true; Component = true, component = true, | 116 env = setmetatable({ |
117 Include = true, include = true, RunScript = dofile }, { __index = function (t, k) | 117 Host = true; host = true; Component = true, component = true, |
118 return rawget(_G, k) or | 118 Include = true, include = true, RunScript = dofile }, { |
119 function (settings_table) | 119 __index = function (t, k) |
120 config[__currenthost or "*"][k] = settings_table; | 120 return rawget(_G, k) or |
121 end; | 121 function (settings_table) |
122 end, | 122 config[__currenthost or "*"][k] = settings_table; |
123 __newindex = function (t, k, v) | 123 end; |
124 set(env.__currenthost or "*", "core", k, v); | 124 end, |
125 end}); | 125 __newindex = function (t, k, v) |
126 set(env.__currenthost or "*", "core", k, v); | |
127 end | |
128 }); | |
126 | 129 |
127 rawset(env, "__currenthost", "*") -- Default is global | 130 rawset(env, "__currenthost", "*") -- Default is global |
128 function env.Host(name) | 131 function env.Host(name) |
129 if rawget(config, name) and rawget(config[name].core, "component_module") then | 132 if rawget(config, name) and rawget(config[name].core, "component_module") then |
130 error(format("Host %q clashes with previously defined %s Component %q, for services use a sub-domain like conference.%s", | 133 error(format("Host %q clashes with previously defined %s Component %q, for services use a sub-domain like conference.%s", |