Module:Labelled list hatnote: Difference between revisions

m 1 revision imported
Don't Lua error when out of expensive parser function calls
Line 86: Line 86:
}
}
return p._labelledList(pages, labels, options)
return p._labelledList(pages, labels, options)
end
local function exists(title)
local success, result = pcall(function() return title.exists end)
if success then
return result
else
return true
end
end
end


Line 93: Line 101:
local v = pages[k]
local v = pages[k]
local title = mw.title.new(getTarget(v), namespace)
local title = mw.title.new(getTarget(v), namespace)
if (v == '') or title == nil or not title.exists then
if (v == '') or title == nil or not exists(title) then
table.remove(pages, k)
table.remove(pages, k)
end
end