Module:If empty: Difference between revisions

Jump to navigation Jump to search
imported>Codehydro
(Undid revision 639373039 by Codehydro (talk) appaarently I do)
imported>Jackmcbarn
(greatly simplify)
Line 1: Line 1:
-- this is intended to replace {{If empty}}
local p = {}
local p = {};
 
function p.run(frame)
function p.main(frame)
local args = require('Module:Arguments').getArgs(frame)
for k,v in ipairs(require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})) do
local i = 0
if v ~= '' then
args[table.getn(args)] = ''
return v
while args[i] == nil or string.len(args[i]) == 0 do
end
i = i + 1
end
end
return args[i]
end
end
return p
return p

Revision as of 19:08, 23 December 2014

Documentation for this module may be created at Module:If empty/doc

local p = {}

function p.main(frame)
	for k,v in ipairs(require('Module:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})) do
		if v ~= '' then
			return v
		end
	end
end

return p