RogerDodger (talk | contribs) No edit summary |
RogerDodger (talk | contribs) (rewrite charSelect to iterate over fighter list in module rather than template) |
||
Line 1: | Line 1: | ||
local | local f = require("Module:Fighter") | ||
p | local p = {} | ||
p. | p._pageTitle = function(p1, p2) | ||
if p1 > p2 then | if p1 > p2 then | ||
p2, p1 = p1, p2 | p2, p1 = p1, p2 | ||
Line 14: | Line 10: | ||
end | end | ||
p. | p._charSelect = function(pov) | ||
r = '' | |||
for _, oppo in ipairs(f.fighters) do | |||
local label = oppo | |||
local class = oppo:lower():gsub("%s+","-") | |||
r = r .. mw.getCurrentFrame():expandTemplate{ | |||
title = "CharSelectChar", | |||
args = { label, class, p._pageTitle(pov, oppo) } | |||
} | |||
end | |||
return r | |||
end | |||
p.charSelect = function(frame) | |||
local pov = frame.args[1] | |||
return p._main(pov) | |||
end | end | ||
return p | return p |
Revision as of 07:14, 2 July 2021
Documentation for this module may be created at Module:Matchup/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+","-")
r = r .. mw.getCurrentFrame():expandTemplate{
title = "CharSelectChar",
args = { label, class, p._pageTitle(pov, oppo) }
}
end
return r
end
p.charSelect = function(frame)
local pov = frame.args[1]
return p._main(pov)
end
return p