Jump to content

Module:ElectoralPerformance

From nUSA Wiki

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