Use function in condition

Status
Not open for further replies.
Level 3
Joined
Sep 28, 2018
Messages
38
Code:
function StrIsInt takes string s returns boolean
        local integer i = 0
        local string char
        loop
            exitwhen i == StringLength(s)
            set char = SubString(s, i, i + 1)
            if not isDigit(char) and not (i == 0 and char == "-") then
                return false
            endif
            set i = i + 1
        endloop
        return true
endfunction

How would one use this function/trigger in a condition? EX: StrIsInt("test") would return false, StrIsInt(5) returns true. But how to access this result and use as a condition?
 
Status
Not open for further replies.
Top