Module:Sandbox/Danski454/chance
< Module:Sandbox
Jump to navigation
Jump to search
Revision as of 19:53, 14 January 2019 by blackwiki>Danski454 (←Created page with '--implement some tasks in Template:2nd chance local p = {} local getArgs = require('Module:Arguments').getArgs function p.main( frame ) local args = getArg...')
| This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
Usage
This module implements many parts of the instructions on Template:2nd chance. This module must be substituted. If it is not, the content cannot be edited and will not be fully parsed.
{{subst:#invoke:Sandbox/Danski454|main|EXACT PAGE NAME}}
--implement some tasks in [[Template:2nd chance]]
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main( frame )
local args = getArgs(frame)
local title = args[1]
local page = mw.title.new( title, 0 )
if (not page) or page.namespace ~= 0 or page.isExternal then
error('"' .. title .. '" is not a valid article title')
elseif not page.exists then
error('"' .. title .. '" does not exist')
elseif page.isRedirect then
error('"' .. title .. '" is a redirect to "' .. page.redirectTarget .. '" you may be looking for that page instead')
end
local content = page.getContent()
end