Module:Sandbox/Danski454/chance

From blackwiki
< Module:Sandbox
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...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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