Module:Logic

From UO Outlands Wiki
Revision as of 01:35, 5 November 2024 by TheGmaster (talk | contribs) (Created page with "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 =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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