Module:Logic

From UO Outlands Wiki
Jump to navigation Jump to search

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

local p = {}

function p.If(frame) -- Checks if a logical statment is true
    local arg1 = frame.args[1]
    local valueIfTrue = frame.args[2]
    local valueIfFalse = frame.args[3]

    if arg1 == true then
        return valueIfTrue
    else
        return valueIfFalse
    end
end

function p.IfEqual(frame) -- Checks if two values are equal
    local arg1 = frame.args[1]
    local arg2 = frame.args[2]
    local valueIfEqual = frame.args[3]
    local valueIfNotEqual = frame.args[4]

    if arg1 == arg2 then
        return valueIfEqual
    else
        return valueIfNotEqual
    end
end

return p