Module:Sandbox/RexxS/GCI09b

From English Wikipedia @ Freddythechick
-- Module to demonstrate a MW library call for Google-Code-in-2017
-- Function pageinfo returns some information about the page

p = {}

p.pageinfo = function( frame )
	local ttl = frame.args.title
	local ttlobj = mw.title.new( ttl )
	if ttlobj then
		local txt = ttlobj.prefixedText
		if ttlobj.exists then
			txt = txt .. " exists"
		else
			txt = txt .. " does not exist"
		end
		if ttlobj.isRedirect then
			txt = txt .. " and is a redirect"
		else
			txt = txt .. " and is not a redirect"
		end
		return txt
	else
		return "Not valid"
	end
end

return p