7,038
edits
No edit summary |
No edit summary |
||
| Line 4: | Line 4: | ||
local args = p.getArgs(frame) | local args = p.getArgs(frame) | ||
local title = mw.title.new(args[1]) | local title = mw.title.new(args[1]) | ||
if not title then | |||
return "{{icon-placeholder}} {{icon-placeholder}} {{icon-placeholder}} {{icon-placeholder}}" | |||
end | |||
local text = title:getContent() | local text = title:getContent() | ||
local games = p.extractGames(text) | local games = p.extractGames(text) | ||
local text = {} | local text = {} | ||
local games2 = { "iii", "vc", "sa", "iv" } | local games2 = { "iii", "vc", "sa", "iv" } | ||
local data | |||
for i,game in ipairs(games2) do | for i,game in ipairs(games2) do | ||
if p.inArray(games, game) then | if p.inArray(games, game) then | ||
data = frame:expandTemplate{title = "icon-"..game} | |||
else | else | ||
data = frame:expandTemplate{title = "icon-placeholder"} | |||
end | end | ||
table.insert(text, data) | |||
end | end | ||
return table.concat(text, " ") | return table.concat(text, " ") | ||
edits