Jump to content

Module:Sandbox/MSGJ

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 09:32, 20 May 2024 (no prefix). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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