Module:Maps

-- Aim: create formatted table as Map Overview -- source code based on https://lastepoch.gamepedia.com/Module:Equipment and https://lastepoch.gamepedia.com/Helmets, https://lastepoch.gamepedia.com/Template:Equipment local p = {} local cargo = mw.ext.cargo

function p.List( frame ) local args = frame.args local fieldstable = { "_pageName", "Hires_image", "Previews", "Map_length", "Biome", }   local tables = 'Maps' 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 } 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')

tbl:tag("th"):wikitext("Map name"):done

if args.Hires_image ~= "hide" then tbl:tag("th"):wikitext("Hi-res map"):done end if args.Previews ~= "hide" then tbl:tag("th"):wikitext("Preview"):done end if args.Map_length ~= "hide" then tbl:tag("th"):wikitext("Map size"):done end if args.Biome~= "hide" then tbl:tag("th"):wikitext("Biome"):done end tbl:done --Construct the rows in the table for _,row in ipairs(result) do		tr = tbl:tag("tr")

tr:tag("td"):wikitext("" .. row._pageName.. ""):done

if args.Hires_image ~= "hide" then tr:tag("td"):wikitext(""):done end if args.Previews ~= "hide" then tr:tag("td"):wikitext(""):done end if args.Map_length ~= "hide" then tr:tag("td"):wikitext(row.Map_length):done end if args.Biome ~= "hide" then tr:tag("td"):wikitext(row.Biome):done end end return tbl end -- . . . end return p