Module:Trn

From SmashWiki, the Super Smash Bros. wiki
Jump to navigationJump to search

To edit the data of which tournaments are what rank, go to Module:Trn/data.


local tournaments = mw.loadData("Module:Trn/data")

local trn_formatter = {}

function trn_formatter.formatTournamentLink(frame)
	name = frame.args[1]
	disambig = frame.args[2]
	game = frame.args[3]
	defaultFormat = "n"
	if disambig == nil or disambig == "" then
		link = "[[Tournament:"..name.."|"..name.."]]"
	else
		link = "[[Tournament:"..name.." ("..disambig..")|"..name.."]]"
	end
	if game == nil or game == "" then
		fstring = defaultFormat
	else
		tourney = tournaments[name]
		if tourney == nil then
			fstring = defaultFormat
		else
			fstring = tourney[game]
		end
	end
	if fstring == nil or fstring == "" then
		fstring = defaultFormat
	end
	result = string.gsub(fstring,"n",link)
	return result
end

return trn_formatter