https://www.limswiki.org/index.php?title=Module:If_empty&feed=atom&action=historyModule:If empty - Revision history2024-03-29T05:25:02ZRevision history for this page on the wikiMediaWiki 1.36.1https://www.limswiki.org/index.php?title=Module:If_empty&diff=21016&oldid=prevShawndouglas: Created as needed.2015-03-02T23:56:20Z<p>Created as needed.</p>
<p><b>New page</b></p><div>local p = {}<br />
<br />
function p.main(frame)<br />
local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})<br />
<br />
-- For backwards compatibility reasons, the first 8 parameters can be unset instead of being blank,<br />
-- even though there's really no legitimate use case for this. At some point, this will be removed.<br />
local lowestNil = math.huge<br />
for i = 8,1,-1 do<br />
if args[i] == nil then<br />
args[i] = ''<br />
lowestNil = i<br />
end<br />
end<br />
<br />
for k,v in ipairs(args) do<br />
if v ~= '' then<br />
if lowestNil < k then<br />
-- If any uses of this template depend on the behavior above, add them to a tracking category.<br />
-- This is a rather fragile, convoluted, hacky way to do it, but it ensures that this module's output won't be modified<br />
-- by it.<br />
frame:extensionTag('ref', '[[Category:Instances of Template:If_empty missing arguments]]', {group = 'TrackingCategory'})<br />
frame:extensionTag('references', '', {group = 'TrackingCategory'})<br />
end<br />
return v<br />
end<br />
end<br />
end<br />
<br />
return p</div>Shawndouglas