• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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