Documentation for this module may be created at Module:Matchup-new/doc
local f = require("Module:Fighter")
local p = {}
p._pageTitle = function(p1, p2)
if p1 > p2 then
p2, p1 = p1, p2
end
return p1 .. " vs " .. p2
end
p._charSelect = function(pov)
r = ''
for _, oppo in ipairs(f.fighters) do
local label = oppo
local class = oppo:lower():gsub("%s+","-")
local p1 = pov
local p2 = oppo
if p1 > p2 then
p2, p1 = p1, p2
end
r = r .. mw.getCurrentFrame():expandTemplate{
title = "MatchupPage",
args = { label, class, p._pageTitle(pov, oppo) , p1, p2 }
}
end
return r
end
p.charSelect = function(frame)
local pov = frame.args[1]
return p._charSelect(pov)
end
-- A wikitext list of links to matchup pages that exist for this fighter,
-- for use in Template:Navbox matchup
p._navbox = function(pov)
r = ''
for _, oppo in ipairs(f.fighters) do
local pageTitle = p._pageTitle(pov, oppo)
local title = mw.title.new(pageTitle)
if title.exists then
r = r .. "* [[" .. pageTitle .. "|" .. oppo .. "]]\n"
end
end
return r
end
p.navbox = function(frame)
local pov = frame.args[1]
return p._navbox(pov)
end
return p