Module:Lua banner: Difference between revisions

m Protected "Module:Lua banner": Highrisk ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) [cascading]
Fix issue with nil
Line 111: Line 111:
if module ~= "WP:libraryUtil" then
if module ~= "WP:libraryUtil" then
local moduleTitle = mw.title.new(module)
local moduleTitle = mw.title.new(module)
local moduleProt = moduleTitle and moduleTitle.protectionLevels["edit"][1]
local editLevel = moduleTitle.protectionLevels["edit"]
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if editLevel == nil then moduleProt = 0 else
if moduleProt < currentProt then
local moduleProt = moduleTitle and moduleTitle.protectionLevels["edit"][1]
cats[#cats + 1] = protCatName
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
break
if moduleProt < currentProt then
cats[#cats + 1] = protCatName
break
end
end
end
end
end