Module:SkinThemes

-- local p   = {}

local skinData = mw.loadData('Module:SkinData/data') local lib      = require('Module:Feature') local json     = require('Module:JSON') local cmd      = require('Module:Maintenance data') local userError = require('Dev:User error') local IL       = require('Module:ImageLink')

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 s="" for championname in pairs(skinData) do       if championname~=exclude then table.insert(championtable,championname) end end table.sort(championtable) local resulttable={} for _,championname in pairs(championtable) do       resulttable[championname]={} local skintable={} for skinname in pairs(skinData[championname]["skins"]) do           table.insert(skintable,skinname) end table.sort(skintable) for _,skinname in pairs(skintable) do           if skinData[championname]["skins"][skinname]["theme"]~=nil then if type(skinData[championname]["skins"][skinname]["theme"])=="string" then if skinData[championname]["skins"][skinname]["theme"]==theme then table.insert(resulttable[championname],skinname) end else for _,themename in pairs(skinData[championname]["skins"][skinname]["theme"]) do                       if themename==theme then table.insert(resulttable[championname],skinname) end end end end end end for _,championname in pairs(championtable) do       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 --