Jump to content

Module:Sandbox/MSGJ

From Wikipedia, the free encyclopedia
require('strict')
local p = {}

p.main = function(frame)
	return mw.title.new(frame.args[2])[frame.args[1]]
end

p.msg = function(frame)
	return(mw.message.new(frame.args[2])):exists()
end

p.exists = function(frame)
	local exists = false
	local title = mw.title.new(frame.args[1])
	if title.exists then -- not an article if it does not exist
		exists = true
	elseif title.namespace==8 and mw.message.new(title.text):exists() then
		exists = true
	end
	return exists
end

return p