aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index a6e86347..a50e7223 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -107,7 +107,8 @@ do
parsers.lua = {};
function parsers.lua.load(data)
local env;
- env = setmetatable({ Host = true; host = true; }, { __index = function (t, k)
+ -- The ' = true' are needed so as not to set off __newindex when we assign the functions below
+ env = setmetatable({ Host = true; host = true; Component = true, component = true }, { __index = function (t, k)
return rawget(_G, k) or
function (settings_table)
config[__currenthost or "*"][k] = settings_table;
@@ -119,10 +120,21 @@ do
function env.Host(name)
rawset(env, "__currenthost", name);
+ -- Needs at least one setting to logically exist :)
set(name or "*", "core", "defined", true);
end
env.host = env.Host;
+ function env.Component(name)
+ return function (module)
+ set(name, "core", "component_module", module);
+ -- Don't load the global modules by default
+ set(name, "core", "modules_enable", false);
+ rawset(env, "__currenthost", name);
+ end
+ end
+ env.component = env.Component;
+
local chunk, err = loadstring(data);
if not chunk then