Module:Builds

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

function p.List( frame ) local args = frame.args local fieldstable = { "Name", "Class", "Author", "Skills", "SkillNodes", "Shards", "LastVersion", "SearchTags", "Weapon", "Offhand", "BodyArmor", "Amulet", "Helmet", "Belt", "Ring1", "Ring2", "Relic", "Gloves", "Boots", "_pageName", }   local tables = 'Builds' 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.Name ~= "hide" then tbl:tag("th"):wikitext("Build Name"):done end if args.Class ~= "hide" then tbl:tag("th"):wikitext("Class"):done end if args.LastVersion ~= "hide" then tbl:tag("th"):wikitext("Last Updated"):done end if args.Skills == "show" then tbl:tag("th"):wikitext("Skills"):done end if args.Author ~= "hide" then tbl:tag("th"):wikitext("Author"):done end tbl:done --Construct the rows in the table for _,row in ipairs(result) do		tr = tbl:tag("tr") if args.Name ~= "hide" then tr:tag("td"):wikitext("" .. row.Name .. ""):done end if args.Class ~= "hide" then tr:tag("td"):wikitext("" .. row.Class .. ""):done end if args.LastVersion ~= "hide" then tr:tag("td"):wikitext(row.LastVersion):done end if args.Skills == "show" then tr:tag("td"):wikitext(mw.text.listToText( mw.text.split( row.Skills, ',' ) )):done end if args.Author ~= "hide" then tr:tag("td"):wikitext(row.Author):done end end return tbl end -- . . . end return p