Module:Article history: Difference between revisions

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 type(v)k =~= 'tablealiases' then
if type(v.aliases) == 'table' then
local newRet = {}
for _, alias in ipairs(v.aliases) do
tret[aliask] = vnewRet
if v.aliases = nilthen
for _, alias in ipairs(v.aliases) do
ret[alias] = newRet
end
end
return substituteAliases(v, newRet)
v.aliases = nil
else
ret[k] = v
end
return substituteAliases(v)
end
end
return ret
end
obj.cfg = substituteAliases(cfg or require(CONFIG_PAGE))
substituteAliases(obj.cfg)
 
return obj