FANDOM


-- Lua version of MW parser functions
-- Same behavior with better performance
 
-- Equivalent of #if:
-- {{ if | condition | if true | if false }}
local p = {}
local getArgs = require('Module:Arguments').getArgs
 
function p.ifNotEmpty(frame)
    local args = getArgs(frame)
    local retTrue = tostring(arg[2])
    local retFalse = tostring(arg[3])
 
	if args[1] ~= nil then
	    return mw.getCurrentFrame():preprocess(retTrue)
	else
	    return mw.getCurrentFrame():preprocess(retFalse)
	end
end
 
-- Equivalent of #ifeq:
-- {{ ifeq | string1 | string2 | if identical | if different }}
function p.ifEqual(frame)
    local args = getArgs(frame)
 
	if args[1] == args[2] then
	    return mw.getCurrentFrame():preprocess(args[3])
	else
	    return mw.getCurrentFrame():preprocess(args[4])
	end
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on FANDOM

Random Wiki