Module:if empty

From Wiktionary, the free dictionary
Jump to navigation Jump to search

This module implements {{if empty}}.


local export = {}

function export.main(frame)
	local args = require("Module:parameters").process(frame:getParent().args, {
		[1] = {list = true}
	})[1]
	
	for i = 1, #args do
		local v = args[i]
		if v then
			return v
		end
	end
	
	return ""
end

return export