Jump to content

Module:Ifexist

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Raph Williams65 (talk | contribs) at 22:09, 27 April 2025 (Fixed link target). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

-- This module implements {{If-exist}}
 -- optional if template {{If}} seems difficult to use
local p = {}

function p.main(frame)
 title = frame.args[1] -- PAGENAME
 thenthis = frame.args[2] --THEN RETURN THIS
 elsethis = frame.args[3] --ELSE THIS
 if mw.title.new(title).exists == true then
  return thenthis
 else
  return elsethis
-- if title exists then return this, if title doesn't exist then this
   end
end
return p