Comparison

core/configmanager.lua @ 9874:c9f5ccdcdf80

configmanager: Add support for returning warnings
author Matthew Wild <mwild1@gmail.com>
date Wed, 20 Mar 2019 12:19:43 +0000
parent 9241:2d82a926826f
child 9875:99291e124449
comparison
equal deleted inserted replaced
9873:dfaeea570f7e 9874:c9f5ccdcdf80
7 -- 7 --
8 8
9 local _G = _G; 9 local _G = _G;
10 local setmetatable, rawget, rawset, io, os, error, dofile, type, pairs = 10 local setmetatable, rawget, rawset, io, os, error, dofile, type, pairs =
11 setmetatable, rawget, rawset, io, os, error, dofile, type, pairs; 11 setmetatable, rawget, rawset, io, os, error, dofile, type, pairs;
12 local format, math_max = string.format, math.max; 12 local format, math_max, t_insert = string.format, math.max, table.insert;
13 13
14 local envload = require"util.envload".envload; 14 local envload = require"util.envload".envload;
15 local deps = require"util.dependencies"; 15 local deps = require"util.dependencies";
16 local resolve_relative_path = require"util.paths".resolve_relative_path; 16 local resolve_relative_path = require"util.paths".resolve_relative_path;
17 local glob_to_pattern = require"util.paths".glob_to_pattern; 17 local glob_to_pattern = require"util.paths".glob_to_pattern;
100 -- Built-in Lua parser 100 -- Built-in Lua parser
101 do 101 do
102 local pcall = _G.pcall; 102 local pcall = _G.pcall;
103 parser = {}; 103 parser = {};
104 function parser.load(data, config_file, config_table) 104 function parser.load(data, config_file, config_table)
105 local warnings = {};
105 local env; 106 local env;
106 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below 107 -- The ' = true' are needed so as not to set off __newindex when we assign the functions below
107 env = setmetatable({ 108 env = setmetatable({
108 Host = true, host = true, VirtualHost = true, 109 Host = true, host = true, VirtualHost = true,
109 Component = true, component = true, 110 Component = true, component = true,
215 216
216 if not ok then 217 if not ok then
217 return nil, err; 218 return nil, err;
218 end 219 end
219 220
220 return true; 221 return true, warnings;
221 end 222 end
222 223
223 end 224 end
224 225
225 return _M; 226 return _M;