Module:Lua banner: Difference between revisions

Jump to navigation Jump to search
Undid revision 3688766 by meta>IPad365 (talk): it is exactly designed to be called from wikitext: from the {{Lua}} *template*
m (1 revision imported)
MediaWiki>Tacsipacsi
(Undid revision 3688766 by meta>IPad365 (talk): it is exactly designed to be called from wikitext: from the {{Lua}} *template*)
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 36: Line 37:
end
end
local moduleList = mList.makeList('bulleted', moduleLinks)
local moduleList = mList.makeList('bulleted', moduleLinks)
boxArgs.text = 'This ' ..
boxArgs.text = 'Uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList
(mw.title.getCurrentTitle():inNamespaces(828,829) and 'module' or 'template') ..
' uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList
end
end
boxArgs.type = 'notice'
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.small = true
boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=|link=]]'
boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=Lua logo|link=Wikipedia:Lua]]'
return mMessageBox.main('mbox', boxArgs)
return mMessageBox.main('mbox', boxArgs)
end
end
Line 82: Line 81:
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
Anonymous user

Navigation menu