Module:icons: Difference between revisions

Jump to navigation Jump to search
101 bytes removed ,  Yesterday at 14:52
no edit summary
No edit summary
No edit summary
 
Line 5: Line 5:
local title = mw.title.new(args[1])
local title = mw.title.new(args[1])
local text = title:getContent()
local text = title:getContent()
local games = text and p.extractGames(text) or {}
local games = text and p.extractGames(text) or ""
local text = {}
local text = {}
local games2 = { "iii", "vc", "sa", "iv" }
local games2 = { "iii", "vc", "sa", "iv" }
local data
local data
games = games:lower()
for i,game in ipairs(games2) do
for i,game in ipairs(games2) do
if p.inArray(games, game) then
if games:find(game:lower(), 1, false) then
data = frame:expandTemplate{title = "icon-"..game}
data = frame:expandTemplate{title = "icon-"..game}
else
else
Line 33: Line 34:
     local games = text:match("|%s*games%s*=%s*([^|]+)")
     local games = text:match("|%s*games%s*=%s*([^|]+)")
     if not games then
     if not games then
         return {"iii", "vc", "sa", "iv"}
         return "iii vc sa iv"
     end
     end


     games = games:match("^%s*(.-)%s*$") -- trim
     return games:match("^%s*(.-)%s*$") -- trim
 
    local result = {}
    for game in games:gmatch("%S+") do
        table.insert(result, game)
    end
 
    return result
end
end


7,038

edits

Navigation menu