Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:IfEmpty

From bg3.wiki
Revision as of 23:22, 28 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',
		trim = true,
		removeBlanks = true
	})

	for k,v in ipairs(args) do
		if v ~= '' then
			return v
		end
	end
end

return p