Module:ElectoralPerformance

Revision as of 02:39, 14 January 2025 by Jord (talk | contribs) (Created page with "local p = {} function p.showResults(frame) local resultRows = "" for i = 1, 10 do local year = frame["year" .. i] if not year then break end local election = frame["election" .. i] local votes = frame["votes" .. i] local percent = frame["percent" .. i] local seats = frame["seats" .. i] local notes = frame["notes" .. i] resultRows = resultRows .. "|-\n" resultRows = res...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:ElectoralPerformance/doc

local p = {}

function p.showResults(frame)
    local resultRows = ""
    
    for i = 1, 10 do
        local year = frame["year" .. i]
        if not year then break end
        
        local election = frame["election" .. i]
        local votes = frame["votes" .. i]
        local percent = frame["percent" .. i]
        local seats = frame["seats" .. i]
        local notes = frame["notes" .. i]
        
        resultRows = resultRows .. "|-\n"
        resultRows = resultRows .. "| " .. year .. "\n"
        resultRows = resultRows .. "| " .. election .. "\n"
        resultRows = resultRows .. "| " .. votes .. "\n"
        resultRows = resultRows .. "| " .. percent .. "\n"
        resultRows = resultRows .. "| " .. seats .. "\n"
        resultRows = resultRows .. "| " .. notes .. "\n"
    end
    
    return resultRows
end

return p