Module:ShopListTable
Appearance
Documentation for this module may be created at Module:ShopListTable/doc
local p = {}
local cargo = mw.ext.cargo
function p.Main(frame)
local tables = 'base_data'
local fields = 'season,basename,owner,basetype,location,dateestablished'
local args = {
orderBy = 'season ASC, basename ASC',
limit = 100 -- Optional; remove or increase if needed
}
local results = cargo.query(tables, fields, args)
local out = {}
table.insert(out, '{| class="wikitable sortable plainlinks"')
table.insert(out, '! Season !! Base !! Owner !! Type !! Location !! Established')
for _, row in ipairs(results) do
local season = ''
if row.season then
season = row.season:sub(3, -3)
end
if row.basename ~= '$1' and row.basename ~= 'Creeper Cove' then
table.insert(out, '|-')
table.insert(out, string.format('| %s || [[%s]] || %s || %s || %s || %s',
season or '',
row.basename or '',
row.owner or '',
row.basetype or '',
row.location or '',
row.dateestablished or ''
))
end
end
table.insert(out, '|}')
return table.concat(out, '\n')
end
return p