Anonymous user
Module:Effective protection level: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
make the metatable work with the change coming June 5th
(add a metamethod so the action can be passed as the first param to #invoke instead of 'main') |
(make the metatable work with the change coming June 5th) |
||
Line 3:
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p.
local title
if type(pagename) == 'table' then
title = pagename
pagename = title.prefixedText▼
else
title = pagename and mw.title.new(pagename) or mw.title.getCurrentTitle()
end
if action == 'autoreview' then
local level =
if level == 'review' then
return 'reviewer'
Line 34 ⟶ 31:
if level == 'sysop' then
return 'sysop'
elseif
return 'sysop'
elseif level == 'templateeditor' then
Line 65 ⟶ 62:
setmetatable(p, { __index = function(t, k)
return function(
if type(frameOrPagename) == 'table' and frameOrPagename.args then
return t.
else
return t._main(k, frameOrPagename)
end
end
end })
|