Modulo:If empty

À prupositu di Wikipedia

La documentazione per questo modulo può essere creata in Modulo:If empty/man

local p = {}

function p.main(frame)
	local args = require('Modulo:Arguments').getArgs(frame, {wrappers = 'Template:If empty', removeBlanks = false})

	-- Per mutivi di cumpatibilità ind'i ritornu, i primi 8 paràmetri ponu esse
	-- discepati invece di esse bianchi, ancu sì ùn ci hè veramente un casu 
	-- d'usu legittimu per questu. In un certu momentu, questu serà sguassatu.
	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
				-- Sè qualchì usu di stu mudellu dipende da u cumpurtamentu di 
				-- u sopra, aghjunghje à una categuria di tracciamentu. Questa 
				-- hè una manera piuttostu fragile, cunvoluta, pirate di fà, ma 
				-- assicura chì a pruduzione di stu modulu ùn serà micca 
				-- modificata da ellu.
				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