Difference between revisions of "Module:ParserFunctions"

From CrawlWiki
Jump to: navigation, search
(Created page with "local p = {} function p.If(frame) function notBlank(x) return not tostring(x):find("^%s*$") end if notBlank(frame.args[1]) then return frame.args[2] else ...")
 
(No difference)

Latest revision as of 21:47, 18 March 2015

Documentation for this module may be created at Module:ParserFunctions/doc

local p = {}

function p.If(frame)
  function notBlank(x)
    return not tostring(x):find("^%s*$")
  end
  if notBlank(frame.args[1]) then
    return frame.args[2]
  else
    return frame.args[3]
  end
end

return p