Jump to content

Module talk:Arguments

From Fifth Empire Wiki
Revision as of 02:58, 13 April 2014 by wikipedia>Jackmcbarn (Iterator corruption: new section)

Iterator corruption

Template:Ping I found a subtle iterator corruption bug in this module.<syntaxhighlight lang="lua"> local args = require('Module:Arguments').getArgs(frame) for k, v in args do

mw.log(k .. '=' .. (v or 'nil') .. ' ')
if args[k .. 'somesuffix'] then
 mw.log('Found suffix for ' .. k)
end

end </syntaxhighlight> Attempting to read the somesuffix argument causes it to be memoized, adding it to the internal table, which apparently can corrupt the iterator and causes some arguments to be skipped. I've noticed this is only reproducible some of the time. Jackmcbarn (talk) 02:58, 13 April 2014 (UTC)