Module:TournamentGroups

local util_args = require('Module:ArgsUtil') local util_cargo = require('Module:CargoUtil') local util_map = require('Module:MapUtil') local util_esports = require('Module:EsportsUtil') local util_text = require('Module:TextUtil')

local m_team = require('Module:Team')

local h = {}

function h.printTable(groups) local tbl = mw.html.create('table'):addClass('wikitable') for _, group in ipairs(groups) do		local tr = tbl:tag('tr') tr:tag('th'):wikitext(group) tr:tag('td'):wikitext(table.concat(groups[group],', ')) end return tbl end

local p = {} function p.main(frame) local args = util_args.merge local overviewPage = util_esports.getOverviewPage(args.page) local groups = util_text.split(args.groups) local displays = util_text.split(args.displays) for _, group in ipairs(groups) do		groups[group] = util_map.split(args[group], nil, m_team.teamlinkname) end local cargo = {} for i, group in ipairs(groups) do		for _, team in ipairs(groups[group]) do			cargo[#cargo+1] = { _table = 'TournamentGroups', GroupName = group, GroupDisplay = args[group .. '_display'] or displays[i] or group, Team = team, OverviewPage = overviewPage, GroupN = i, PageAndTeam = overviewPage .. '_' .. team, }		end end for _, tbl in ipairs(cargo) do		util_cargo.store(tbl, frame) end return h.printTable(groups) end return p