Module:Passives

local p = {} local cargo = mw.ext.cargo

function p.List( frame ) local args = frame.args local fieldstable = { "Icon", "Name", "Description", "Class", "MaxPoints", "NodeUnlock", "LevelUnlock", "Mods", "_pageName", }   local tables = 'Passives' local fields = table.concat(fieldstable,",") -- optional parameters are grouped in one table -- you can omit any or all of them, except joinOn if you use more than one table local cargoquery = { where = args.where, groupBy = "_pageName" , orderBy = args.orderby} local result = mw.ext.cargo.query( tables, fields, cargoquery )

if result[1] == nil then return args.default

elseif result[1] ~= nil then --Start the table local tbl = mw.html.create('table') tbl:addClass('wikitable sortable mw-datatable') if args.Icon ~= "hide" then tbl:tag("th"):wikitext("Icon"):done end if args.Name ~= "hide" then tbl:tag("th"):wikitext("Passive Name"):done end if args.Description ~= "hide" then tbl:tag("th"):wikitext("Passive Description"):done end if args.Class ~= "hide" then tbl:tag("th"):wikitext("Class"):done end if args.MaxPoints ~= "hide" then tbl:tag("th"):wikitext("Max Points"):done end if args.LevelUnlock ~= "hide" then tbl:tag("th"):wikitext("Unlocked Lvl."):done end if args.NodeUnlock ~= "hide" then tbl:tag("th"):wikitext("Required Passive"):done end if args.Mods == "show" then tbl:tag("th"):wikitext("Mods"):done end tbl:done --Construct the rows in the table for _,row in ipairs(result) do		tr = tbl:tag("tr") if args.Icon ~= "hide" then tr:tag("td"):wikitext(row.Icon):done end if args.Name ~= "hide" then tr:tag("td"):wikitext("" .. row.Name .. ""):done end if args.Description ~= "hide" then tr:tag("td"):wikitext(row.Description):done end if args.Class ~= "hide" then tr:tag("td"):wikitext(row.Class):done end if args.MaxPoints ~= "hide" then tr:tag("td"):wikitext(row.MaxPoints):done end if args.LevelUnlock ~= "hide" then tr:tag("td"):wikitext(row.LevelUnlock):done end if args.NodeUnlock ~= "hide" then tr:tag("td"):wikitext(row.NodeUnlock):done end if args.Mods == "show" then tr:tag("td"):wikitext(mw.text.listToText( mw.text.split( row.Mods, ',' ) )):done end end return tbl end -- . . . end return p