Jump to content

Module:ElectoralPerformance: Difference between revisions

From nUSA Wiki
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..."
 
m Protected "Module:ElectoralPerformance" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
 
(No difference)

Latest revision as of 02:40, 14 January 2025

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