Module:Room features: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(hide loc qty if 1, add version name)
m (Add null check for table insert)
Line 37: Line 37:
local ret = ''
local ret = ''
local location = args[1] or mw.title.getCurrentTitle().fullText
local location = args[1] or mw.title.getCurrentTitle().fullText

local query = mw.smw.ask(base_query(location))
local query = mw.smw.ask(base_query(location))
if query ~= nil then
if query ~= nil then
Line 46: Line 46:
for i,v in ipairs(query) do
for i,v in ipairs(query) do
local key = infobox_cat_map[v.infobox_sub or v.infobox]
local key = infobox_cat_map[v.infobox_sub or v.infobox]
-- Can be nil - See East Beach for example
table.insert(results_by_type[key], v)
if key ~= nil then
table.insert(results_by_type[key], v)
end
end
end
for cat,results in pairs(results_by_type) do
for cat,results in pairs(results_by_type) do