Welcome to SmashWiki! Log in or create an account and join the community, and don't forget to read this first!
Notices
The Skill parameter has been removed from Smasher infoboxes, and in its place are the new "Best historical ranking" and "Best tournament result" parameters. SmashWiki needs help adding these new parameters to Smasher infoboxes, refer to the guidelines here for what should be included in these new parameters.
When adding results to Smasher pages, include each tournament's entrant number in addition to the player's placement, and use the {{Trn}} template with the matching game specified. Please also fix old results on Smasher pages that do not abide to this standard. Refer to our Smasher article guidelines to see how results tables should be formatted.
Check out our project page for ongoing projects that SmashWiki needs help with.

Module:Trn: Difference between revisions

From SmashWiki, the Super Smash Bros. wiki
Jump to navigationJump to search
(proof of concept)
 
(split out list)
Line 1: Line 1:
local default = "n"
local tournaments = mw.loadData("Module:Trn/data")
local major = "'''n'''"
local supermajor = "'''''n'''''"
 
local tournaments = {
["Beeg T"] = {["SSBM"] = major, ["SSBU"] = supermajor},
["Smaller T"] = {["SSBM"] = default, ["SSBB"] = major},
}


local trn_formatter = {}
local trn_formatter = {}
Line 14: Line 7:
disambig = frame.args[2]
disambig = frame.args[2]
game = frame.args[3]
game = frame.args[3]
defaultFormat = "n"
if disambig == nil or disambig == "" then
if disambig == nil or disambig == "" then
link = "[[Tournament:"..name.."|"..name.."]]"
link = "[[Tournament:"..name.."|"..name.."]]"
Line 20: Line 14:
end
end
if game == nil or game == "" then
if game == nil or game == "" then
fstring = default
fstring = defaultFormat
else
else
tourney = tournaments[name]
tourney = tournaments[name]
if tourney == nil then
if tourney == nil then
fstring = default
fstring = defaultFormat
else
else
fstring = tourney[game]
fstring = tourney[game]
Line 30: Line 24:
end
end
if fstring == nil or fstring == "" then
if fstring == nil or fstring == "" then
fstring = default
fstring = defaultFormat
end
end
result = string.gsub(fstring,"n",link)
result = string.gsub(fstring,"n",link)

Revision as of 19:11, January 29, 2024

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