Content deleted Content added
bug fixes for the config alias substitution |
more bug fixes for the config formatting function - we can't add values to the same table at the same time we are iterating over it, so build a new config table instead |
||
Line 111:
-- Format the config
local function substituteAliases(t, ret)
-- This function substitutes strings found in an "aliases" subtable
-- as keys in the parent table. It works recursively, so "aliases"
Line 117:
-- not be nested recursively, which should be true in the case of our
-- config file.
ret = ret or {}
for k, v in pairs(t) do
if
if type(v
local newRet = {}
for _, alias in ipairs(v.aliases) do▼
▲ for _, alias in ipairs(v.aliases) do
ret[alias] = newRet
end
end
▲ v.aliases = nil
else
ret[k] = v
end
▲ return substituteAliases(v)
end
end
return ret
end
obj.cfg = substituteAliases(cfg or require(CONFIG_PAGE))
return obj
|