Module:Arguments: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
fix bug where explicitly deleted args were still appearing when iterated over with pairs or ipairs - code courtesy of User:Jackmcbarn
m (1 revision from w:en:Module:Arguments: attempt import of uptodate version)
(fix bug where explicitly deleted args were still appearing when iterated over with pairs or ipairs - code courtesy of User:Jackmcbarn)
Line 170:
-- into one table using the specified iterator. If a value is already
-- present it is not overwritten; tables listed earlier have precedence.
-- We are also memoizing nil values, but those valueswhich can be overwritten if they
-- overwrittenare 's' (soft).
--]]
for _, t in ipairs(tables) do
for key, val in iterator(t) do
if metaArgs[key] == nil and nilArgs[key] ~= 'h' then
local tidiedVal = tidyVal(key, val)
if tidiedVal == nil then
nilArgs[key] = true's'
else
metaArgs[key] = tidiedVal
Line 219:
for _, argTable in ipairs(argTables) do
local argTableVal = tidyVal(key, argTable[key])
if argTableVal =~= nil then
nilArgs[key] = true
else
metaArgs[key] = argTableVal
return argTableVal
end
end
nilArgs[key] = true'h'
return nil
end
Line 255 ⟶ 254:
--]]
metaArgs[key] = nil
nilArgs[key] = true'h'
else
metaArgs[key] = val
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu