Module:ListSeries

local p = {} require("Module:StrManip") require('Module:Card') local cargo = mw.ext.cargo --https://help.gamepedia.com/Extension:Cargo --https://www.mediawiki.org/wiki/Extension:Cargo

--cargo query by field function listBySeries(series) local qFields = "Name, Image, Type, SubType, Series, VA, Role, Type, SubType" local qArgs = { where = "Series = '" .. tostring(series) .. "'",       orderBy = "Name", limit = 9000,

}   local lolis = cargo.query("loliInfo",qFields, qArgs) mw.logObject(lolis) local root = mw.html.create('div') :cssText('display:flex; flex-flow:row wrap; hyphens:Auto;')

for i,loli in ipairs(lolis) do       --mw.logObject(i) --mw.logObject(loli) root:Card(loli) end

return root end

--main function function p.listSeries local args = mw.getCurrentFrame.args[1] local qFields = "Series" local qArgs = { orderBy = "Series", limit = 15, --limit = 9000, }   local seriesAll = cargo.query("loliInfo",qFields, qArgs) --mw.logObject(seriesAll)

--create one entry for each series local seriesList = {} for i,series in ipairs(seriesAll) do       local series = trim(series["Series"]:gsub(" -%(.*%) -",""):gsub(" -%[.*%] -",""):gsub(" -%{.*%} -","")) --mw.logObject(series) if not inTab(seriesList,series) then --mw.logObject(series .. " not yet added to list, adding") table.insert(seriesList,series) end end mw.logObject(seriesList)

--start to assemble list

local listString = "" for i,series in ipairs(seriesList) do       mw.logObject(series) listBySeries(series) listString = listString .. "| style='height:12px;background:#70547c;border: 2px solid #70547c' colspan=2 |\n" listString = listString .. "|-\n" listString = listString .. "| style='background:#17111b;text-align:center;color:#eee;font-weight:bold;font-size:25px;font-family:%'Franklin Gothic%';border: 2px solid #70547c' colspan=2 | .. series .. \n" listString = listString .. "|-\n" listString = listString .. "| style='background:#70547c;border: #70547c 2px solid' | " .. "listBySeries(series)" .. "\n" listString = listString .. "|-\n" end

--can't get listbyseries' output to work here. what do I do?

end

return p