Module:Bracket/sandbox explained

local p =

local teamBracket = require('Module:Team bracket').main

function p._teamBracket(frame, template, subs, defs) args = -- assign defaults for k, v in pairs(defs) do args[k] = v end -- figure out parameters from template name teams = mw.ustring.match(template or , "^(%d*)Team") if not teams then teams = mw.ustring.match(template or , "^(%d*)Round") elseif teams

"4" then args.rounds = args.rounds or 2 elseif teams

"8" then args.rounds = args.rounds or 3 elseif teams

"16" then args.rounds = args.rounds or 4 end tennis = mw.ustring.match(template or , "-Tennis(%d*)") if tennis then args.sets = args.sets or tennis args.seeds = args.seeds or 'yes' args.nowrap = args.nowrap or 'yes' end if string.find(template, "-Compact") then args.compact = args.compact or 'yes' end -- get args and alternative args for k, v in pairs(frame:getParent.args) do if subs[k] then args[subs[k]] = v else args[k] = v end end --return template return require('Module:Team bracket').main(frame:newChild)end

function p.FourTeamBracket(frame) return p._teamBracket(frame, '4TeamBracket',,)endp['4TeamBracket'] = p.FourTeamBracket

function p.FourTeamBracketTennis3(frame) return p._teamBracket(frame, '4TeamBracket-Tennis3',,)endp['4TeamBracket-Tennis3'] = p.FourTeamBracketTennis3

function p.FourTeamBracketTennis5(frame) return p._teamBracket(frame, '4TeamBracket-Tennis5',,)endp['4TeamBracket-Tennis5'] = p.FourTeamBracketTennis5

function p.FourTeamBracketTennis35(frame) return p._teamBracket(frame, '4TeamBracket-Tennis35',,)endp['4TeamBracket-Tennis35'] = p.FourTeamBracketTennis35

function p.EightTeamBracket(frame) return p._teamBracket(frame, '8TeamBracket',,)endp['8TeamBracket'] = p.EightTeamBracket

function p.EightTeamBracketByes(frame) return p._teamBracket(frame, '8TeamBracket-Byes',,)endp['3RoundBracket-Byes'] = p.EightTeamBracketByesp['8TeamBracket-Byes'] = p.EightTeamBracketByes

function p.EightTeamBracketTennis3(frame) return p._teamBracket(frame, '8TeamBracket-Tennis3',,)endp['8TeamBracket-Tennis3'] = p.EightTeamBracketTennis3

function p.EightTeamBracketTennis5(frame) return p._teamBracket(frame, '8TeamBracket-Tennis5',,)endp['8TeamBracket-Tennis5'] = p.EightTeamBracketTennis5

function p.SixteenTeamBracket(frame) return p._teamBracket(frame, '16TeamBracket',,)endp['16TeamBracket'] = p.SixteenTeamBracket

function p.SixteenTeamBracketByes(frame) return p._teamBracket(frame, '16TeamBracket-Byes',,)endp['4RoundBracket-Byes'] = p.SixteenTeamBracketByesp['16TeamBracket-Byes'] = p.SixteenTeamBracketByes

function p.SixteenTeamBracketTennis3(frame) return p._teamBracket(frame, '16TeamBracket-Tennis3',,)endp['16TeamBracket-Tennis3'] = p.SixteenTeamBracketTennis3

function p.SixteenTeamBracketCompactTennis3(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis3',,)endp['16TeamBracket-Compact-Tennis3'] = p.SixteenTeamBracketCompactTennis3

function p.SixteenTeamBracketCompactTennis3Byes(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis3-Byes',,)endp['16TeamBracket-Compact-Tennis3-Byes'] = p.SixteenTeamBracketCompactTennis3Byesp['4RoundBracket-Compact-Tennis3-Byes'] = p.SixteenTeamBracketCompactTennis3Byes

function p.SixteenTeamBracketTennis5(frame) return p._teamBracket(frame, '16TeamBracket-Tennis5',,)endp['16TeamBracket-Tennis5'] = p.SixteenTeamBracketTennis5

function p.SixteenTeamBracketCompactTennis5(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis5',,)endp['16TeamBracket-Compact-Tennis5'] = p.SixteenTeamBracketCompactTennis5

function p.SixteenTeamBracketCompactTennis5Byes(frame) return p._teamBracket(frame, '16TeamBracket-Compact-Tennis5-Byes',,)endp['16TeamBracket-Compact-Tennis5-Byes'] = p.SixteenTeamBracketCompactTennis5Byesp['4RoundBracket-Compact-Tennis5-Byes'] = p.SixteenTeamBracketCompactTennis5Byes

return p