Search
Toggle search
Toggle menu
Toggle personal menu
Editing
Module:If empty
From InfraWiki
Read
Edit source
View history
Module
Discussion
More actions
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p.main(frame) local args = require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false}) -- For backwards compatibility reasons, the first 8 parameters can be unset instead of being blank, -- even though there's really no legitimate use case for this. At some point, this will be removed. local lowestNil = math.huge for i = 8,1,-1 do if args[i] == nil then args[i] = '' lowestNil = i end end for k,v in ipairs(args) do if v ~= '' then if lowestNil < k then -- If any uses of this template depend on the behavior above, add them to a tracking category. -- This is a rather fragile, convoluted, hacky way to do it, but it ensures that this module's output won't be modified -- by it. frame:extensionTag('ref', '[[Category:Instances of Template:If_empty missing arguments]]', {group = 'TrackingCategory'}) frame:extensionTag('references', '', {group = 'TrackingCategory'}) end return v end end end return p
Summary:
Please note that all contributions to InfraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:If empty/doc
(
edit
)