Module:IfEmpty

From Baldur's Gate 3 Wiki
Revision as of 00:38, 29 November 2023 by Taylan (talk | contribs)

This module implements the functionality of Template:IfEmpty. It returns the first template argument that's not empty or whitespace-only.


local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.main(frame)
	local args = getArgs(frame, { wrappers = 'Template:IfEmpty' })
	p._main(args)
end

function p._main(args)
	for i, v in ipairs(args) do
		if v ~= '' then
			return v
		end
	end
end

return p