Module:Arguments/sandbox: Difference between revisions

Content deleted Content added
Jackmcbarn (talk | contribs)
Reverted to revision 604023633 by Mr. Stradivarius (talk). (TW)
Jackmcbarn (talk | contribs)
if we've already ran pairs, and a value is nil in metaArgs, then we know it's not going to be anywhere in argTables, since we already put everything from those into metaArgs. (right?)
Line 157:
metatable.__index = function (t, key)
local val = metaArgs[key]
if metatable.donePairs or val ~= nil then
if val == nilArg then
return nil
Line 167:
local argTableVal = tidyVal(key, argTable[key])
if argTableVal == nil then
metaArgs[key] = nilArg
if not metatable.donePairs then
--[[
-- Memoize nils, but not if pairs has been used on the args
-- table. The pairs check is to avoid the possibility of
-- adding new entries to the table during the pairs
-- iteration, as this produces undefined behaviour in the
-- next() function.
--]]
metaArgs[key] = nilArg
end
else
metaArgs[key] = argTableVal