Module:Ifexists

local p = {}

function p.exists( frame ) local tArgs = frame:getParent if not(tArgs.args[1]) then tArgs = frame end

local sText = tArgs.args[1] local sTrueAction = tArgs.args[2] or tArgs.args["true"] local sFalseAction = tArgs.args[3] or tArgs.args["false"]

if sText and sText ~= "" then if mw.title.new( sText ).exists then return sTrueAction else return sFalseAction end end end return p