Module:Sandbox/Julio974fr/positions explained

local p =

--

local positionsData =

function p._fetch(args) if not args[1] then mw.addWarning("parameter 1 should be a party QID.") end if not args[2] then mw.addWarning("parameter 2 should be a year") return nil end if not positionsData[args[1]] then mw.addWarning('No position set for '..args[1]) return 0.5 end local partyData = positionsData[args[1]] if type(partyData)

'number' then return partyData end local position -- If multiple positions for multiple years for _, v in ipairs(partyData) do if v[1] <= args[2] then position = v[2] end end return positionend

function p.fetch(frame) -- Initialise and populate variables local getArgs = require("Module:Arguments").getArgs local args = getArgs(frame) return p._fetch(args)end

return p