Requirements for clean trigger condition usage

uberfoop

~=Admiral Stukov=~
Reaction score
177
I've never really dealt with conditions on permanent triggers before, and it seems like different systems deal with this differently, so I was wondering how to ensure unleakiness on something like this, where you want to save the condition to be called later:

JASS:

globals
    trigger PermanentTrigger = CreateTrigger()
    triggercondition GlobalTriggerCondition
    boolexpr GlobalBoolExpr
endglobals

function LastFunction takes nothing returns nothing
    call TriggerEvaluate(PermanentTrigger)
    call TriggerRemoveCondition(PermanentTrigger,GlobalTriggerCondition)
    call DestroyBoolExpr(GlobalBoolExpr)
endfunction

function FirstFunction takes code c returns nothing
    set GlobalBoolExpr = Condition(c)
    set GlobalTriggerCondition = TriggerAddCondition(PermanentTrigger,GlobalBoolExpr)
endfunction

Or is this already leak-free?



Also, does anything bad happen if a trigger's condition/a boolexpr function DOESN'T return a boolean? It seems like it still works, but I don't think i've ever seen anyone break the boolean return convention.
Nevermind on that part. Messes up Macs.


Thanks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top