Jump to content

Module:Sandbox/S.A. Julio

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by S.A. Julio (talk | contribs) at 00:07, 3 June 2024 (test page). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local p = {}

function p.generateTable(frame)
    local args = frame:getParent().args
    local wikitable = '{| class="wikitable" style="text-align:center"\n'
    wikitable = wikitable .. '|-\n'
    wikitable = wikitable .. '! style="text-align:right; width:250px"|Team 1\n'
    wikitable = wikitable .. '! style="width:80px"|{{Abbrlink|Agg.|Aggregate score}}\n'
    wikitable = wikitable .. '! style="text-align:left; width:250px"|Team 2\n'
    wikitable = wikitable .. '! style="width:80px"|1st leg\n'
    wikitable = wikitable .. '! style="width:80px"|2nd leg\n'

    local i = 1
    while args[i] do
        local team1 = args[i] or ""
        local team1Icon = args[i + 1] or ""
        local aggregateScore = args[i + 2] or ""
        local team2 = args[i + 3] or ""
        local team2Icon = args[i + 4] or ""
        local firstLeg = args[i + 5] or ""
        local secondLeg = args[i + 6] or ""
        
        wikitable = wikitable .. '|-\n'
        wikitable = wikitable .. '|style="text-align: right;"|' .. team1 .. ' {{fbaicon|' .. team1Icon .. '|variant=}}\n'
        wikitable = wikitable .. '|style="text-align: center;"|' .. aggregateScore .. '\n'
        wikitable = wikitable .. '|style="text-align: left;"|{{fbaicon|' .. team2Icon .. '|variant=}} ' .. team2 .. '\n'
        wikitable = wikitable .. '|style="text-align: center;"|' .. firstLeg .. '\n'
        wikitable = wikitable .. '|style="text-align: center;"|' .. secondLeg .. '\n'
        
        i = i + 7
    end

    wikitable = wikitable .. '|}\n'
    
    return wikitable
end

return p