Module:ShopListTable: Difference between revisions
Appearance
fixed query |
updated shop type |
||
| Line 28: | Line 28: | ||
row.shopname or '', | row.shopname or '', | ||
row.shopowner or '', | row.shopowner or '', | ||
row. | row.shoptype or '', | ||
row.location or '', | row.location or '', | ||
row.dateopened or '' | row.dateopened or '' | ||
Latest revision as of 14:56, 24 June 2025
Documentation for this module may be created at Module:ShopListTable/doc
local p = {}
local cargo = mw.ext.cargo
function p.Main(frame)
local tables = 'shop_data'
local fields = 'season,shopname,shopowner,shoptype,location,dateopened'
local args = {
orderBy = 'season ASC, shopname 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 !! Shop !! 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.shopname ~= '$1' and row.shopname ~= 'Diamond Emporium' then
table.insert(out, '|-')
table.insert(out, string.format('| %s || [[%s]] || %s || %s || %s || %s',
season or '',
row.shopname or '',
row.shopowner or '',
row.shoptype or '',
row.location or '',
row.dateopened or ''
))
end
end
table.insert(out, '|}')
return table.concat(out, '\n')
end
return p