Comparison

core/configmanager.lua @ 795:e27a48e35bbb

Add RunScript command to config to run a Lua script prior to starting the server
author Matthew Wild <mwild1@gmail.com>
date Fri, 13 Feb 2009 14:43:12 +0000
parent 794:912dc389935a
child 857:49298263f241
comparison
equal deleted inserted replaced
794:912dc389935a 795:e27a48e35bbb
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 = 12 local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile =
13 setmetatable, loadfile, pcall, rawget, rawset, io, error; 13 setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile;
14 14
15 module "configmanager" 15 module "configmanager"
16 16
17 local parsers = {}; 17 local parsers = {};
18 18
96 parsers.lua = {}; 96 parsers.lua = {};
97 function parsers.lua.load(data) 97 function parsers.lua.load(data)
98 local env; 98 local env;
99 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below 99 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below
100 env = setmetatable({ Host = true; host = true; Component = true, component = true, 100 env = setmetatable({ Host = true; host = true; Component = true, component = true,
101 Include = true, include = true }, { __index = function (t, k) 101 Include = true, include = true, RunScript = dofile }, { __index = function (t, k)
102 return rawget(_G, k) or 102 return rawget(_G, k) or
103 function (settings_table) 103 function (settings_table)
104 config[__currenthost or "*"][k] = settings_table; 104 config[__currenthost or "*"][k] = settings_table;
105 end; 105 end;
106 end, 106 end,