Module:If

From JoJo's Bizarre Encyclopedia - JoJo Wiki
Jump to navigation Jump to search

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

local p = {}

function p.main( 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 == "" then
        sText = mw.getCurrentFrame():preprocess(sFalseAction)
    else
        sText = mw.getCurrentFrame():preprocess(sTrueAction)
    end
    return sText
end
return p