Module:Logs

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

function p.List( frame ) local args = frame.args local fieldstable = { "Logs.Quest=QuestName", "Logs.Objective=Objective", "Logs.Location=LogLocation", "Logs.NPC=NPC", "Logs.Log=Log", "Logs.Status=Status", "Locations.Name=lName", "Locations.Level=Level", "Locations.Eras=Eras", }   local tables = 'Logs, Locations' 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, join='Logs.Location=Locations.Name', orderBy='Logs.Quest' }   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.QuestName ~= "hide" then tbl:tag("th"):wikitext("Quest Name"):done end if args.Objective ~= "hide" then tbl:tag("th"):wikitext("Objective"):done end if args.Status ~= "hide" then tbl:tag("th"):wikitext("Status"):done end if args.NPC ~= "hide" then tbl:tag("th"):wikitext("NPC"):done end if args.Level ~= "hide" then tbl:tag("th"):wikitext("Level"):done end if args.LogLocation == "show" then tbl:tag("th"):wikitext("Location"):done end if args.Log == "show" then tbl:tag("th"):wikitext("Log Entry"):done end tbl:done --Construct the rows in the table for _,row in ipairs(result) do		tr = tbl:tag("tr") if args.QuestName ~= "hide" then tr:tag("td"):wikitext("" .. row.QuestName .. ""):done end if args.Objective ~= "hide" then tr:tag("td"):wikitext(row.Objective):done end if args.Status ~= "hide" then tr:tag("td"):wikitext(row.Status):done end if args.NPC ~= "hide" then tr:tag("td"):wikitext(row.NPC):done end if args.Level ~= "hide" then tr:tag("td"):wikitext(row.Level):done end if args.LogLocation == "show" then tr:tag("td"):wikitext(row.XP):done end if args.Log == "show" then tr:tag("td"):wikitext(row.Log):done end end return tbl end -- . . . end return p