Please make sure your email address matches on the wiki and website as we'll be migrating to PCB logins in the near future. |
Difference between revisions of "Module:Lua banner"
Jump to navigation
Jump to search
TheOctopus (talk | contribs) m (1 revision imported: Import Template:For docs) |
TheOctopus (talk | contribs) m (1 revision imported: Imported see also) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
-- This module implements the {{lua}} template. | -- This module implements the {{lua}} template. | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
local mList = require('Module:List') | local mList = require('Module:List') | ||
Line 37: | Line 36: | ||
end | end | ||
local moduleList = mList.makeList('bulleted', moduleLinks) | local moduleList = mList.makeList('bulleted', moduleLinks) | ||
boxArgs.text = ' | boxArgs.text = 'This template uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList | ||
end | end | ||
boxArgs.type = 'notice' | boxArgs.type = 'notice' | ||
Line 81: | Line 80: | ||
end | end | ||
cats[#cats + 1] = category | cats[#cats + 1] = category | ||
local protLevels = { | |||
autoconfirmed = 1, | |||
extendedconfirmed = 2, | |||
templateeditor = 3, | |||
sysop = 4 | |||
} | |||
local currentProt = titleObj.protectionLevels["edit"][1] | |||
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end | |||
for i, module in ipairs(modules) do | |||
local moduleProt = mw.title.new(module).protectionLevels["edit"][1] | |||
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end | |||
if moduleProt < currentProt then | |||
cats[#cats + 1] = "Templates using under-protected Lua modules" | |||
break | |||
end | |||
end | |||
end | end | ||