Difference between revisions of "Module:Effective protection level"
Module:Effective protection level (view source)
Revision as of 19:38, 19 April 2014
, 19:38, 19 April 2014let one function work for other modules and for wikitext
>Jackmcbarn (add PC detection, from sandbox) |
>Jackmcbarn (let one function work for other modules and for wikitext) |
||
Line 3: | Line 3: | ||
-- Returns the permission required to perform a given action on a given title. | -- 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. | -- If no title is specified, the title of the page being displayed is used. | ||
function p.main(action, pagename | function p.main(frame, action, pagename) | ||
frame = frame or mw.getCurrentFrame() | |||
action = action or frame.args.action or frame.args[1] | |||
pagename = pagename or frame.args.pagename or frame.args[2] | |||
local title | local title | ||
if type(pagename) == 'table' then | if type(pagename) == 'table' then | ||
Line 62: | Line 62: | ||
end | end | ||
end | end | ||
end | end | ||
return p | return p |