Modul:Lua banner: Unterschied zwischen den Versionen

protect against "mw.title.new()" returns "nil"
K (1 Version importiert)
Modul>Uzume
(protect against "mw.title.new()" returns "nil")
Zeile 35: Zeile 35:
moduleLinks[i] = string.format('[[:%s]]', module)
moduleLinks[i] = string.format('[[:%s]]', module)
local maybeSandbox = mw.title.new(module .. '/sandbox')
local maybeSandbox = mw.title.new(module .. '/sandbox')
if maybeSandbox.exists then
if maybeSandbox and maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
end
Zeile 110: Zeile 110:
for i, module in ipairs(modules) do
for i, module in ipairs(modules) do
if module ~= "WP:libraryUtil" then
if module ~= "WP:libraryUtil" then
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
local moduleTitle = mw.title.new(module)
local moduleProt = moduleTitle and moduleTitle.protectionLevels["edit"][1]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
if moduleProt < currentProt then
Anonymer Benutzer