Module:SkinThemes

-- local p   = {}

local skinData = mw.loadData('Module:SkinData/data') local lib      = require('Module:Feature') local userError = require('Dev:User error')

function p.get(frame) local args; if frame.args == nil then args = lib.arguments(frame) else args = lib.arguments(frame.args) end local theme  = args[1] or nil local exclude = args[2] or nil local championtable = {} local resulttable  = {} for championname in pairs(skinData) do       if championname ~= exclude then for skinname in pairs(skinData[championname]["skins"]) do               local set = skinData[championname]["skins"][skinname]["set"] if set ~= nil then if type(set) == "string" then if set == theme then if resulttable[championname] == nil then resulttable[championname] = {} table.insert(championtable, championname) end table.insert(resulttable[championname], skinname) end else for _, subset in pairs(set) do                           if subset == theme then if resulttable[championname] == nil then resulttable[championname] = {} table.insert(championtable, championname) end table.insert(resulttable[championname], skinname) end end end end end end end table.sort(championtable) local s = "" for _, championname in pairs(championtable) do       table.sort(resulttable[championname]) for _, skinname in pairs(resulttable[championname]) do           if s == "" then s =     "\n**" .. csl(championname, skinname, frame) else s = s .. "\n**" .. csl(championname, skinname, frame) end end end return s end

function csl(champion, skin, frame) return frame:expandTemplate{ title = "csl", args = {champion, skin} } end

return p --