Module:IDF Pro Tour Rankings

From Fanverse
Jump to navigation Jump to search

Documentation for this module may be created at Module:IDF Pro Tour Rankings/doc

local p = {}

local data = require("Module:IDF Pro Tour Rankings/data")

function p.main(frame)
    local output = {}

    table.insert(output, '{| class="wikitable sortable"')
    table.insert(output, '! Rank !! Player !! Earnings')

    for _, player in ipairs(data.rankings) do
        table.insert(output, '|-')
        table.insert(output, '| ' .. player[2] .. ' || [[' .. player[1] .. ']] || ' .. player[3])
    end

    table.insert(output, '|}')

    return table.concat(output, '\n')
end

-- support |list (fixes your original error too)
function p.list(frame)
    return p.main(frame)
end

return p