Info Istruzioni per l'uso
Questo è un modulo scritto in Lua. Le istruzioni che seguono sono contenute nella sottopagina Modulo:MultiBand/man (modifica · cronologia)
Sandbox: Modulo:MultiBand/sandbox (modifica · cronologia) · Sottopagine: lista · Test: Modulo:MultiBand/test (modifica · cronologia · esegui)

Questo modulo serve in appoggio al Template:MultiBand per permettere un numero illimitato di cambi di denominazioni societarie e/o dei colori della società.

Vedi il manuale del template per l'uso.


-- modulo per gestire l'omonimo template
-- la gestione dei parametri con numeri progressivi prende spunto da Modulo:Tracce

local args = {}
local maxInterval = 0

local function getValue(param, year)
	result = ""
	for i=1,maxInterval do
		currentYear = args["anno" .. i]
		if currentYear > year then break end
		temp = args[param .. i]
		if temp ~=nil then
			result = args[param .. i]
		end
	end
	return result
end

local p = {}

function p.get(frame)
	local pframe = frame:getParent()
	for k, v in pairs( pframe.args ) do
		-- mappo gli argomenti del template 
		if v ~=nil then args[k] = v end
		-- cerco l'intervallo più recente in base al numero più alto fra "nomeN", "voceN" e "immN"
		num = string.match(k, "(?:nome|voce|imm)(%d+)$")
		if num then
			if tonumber(num) > maxInterval then
				maxInterval = num
			end
		end
	end
    
	local year = args["anno"]
	if year == nil then year = getValue("anno", maxInterval) end
		
	return "|nome = " .. getValue("nome", year)
		.. "|voce = " .. getValue("voce", year)
		.. "|imm = " .. getValue("imm", year)
end

return p