Azlier
Old World Ghost
- Reaction score
- 461
Well, I guess it's time I contributed something to the community here. Here we go, even if it is a terrible title for a thread.
Ever since I learned JASS, I've been wondering about those boolexprs. Particularly the ones in trigger events. The thinking went, "Which is worse? A leaking boolexpr or the function calls needed to fix them?" So, I devised a plan to get rid of both. (If someone's done this before, stop me now.)
Why not store the boolexpr in a simple global variable? A fine plan, I thought. So, I experimented and replaced all my Filter(function True) with a more compact True. And it worked just as planned. Now, I decide to post it here .
Simply inject the variable and the setup function and code into your Map Initialization library. There, we can now utilize the magic of the word True!
Now, instead of things like
or
we can simply put
No leaks, and a single extra function call throughout the game. Not so bad now, is it? Well, I do hope this helps optimize/simplify code for some people.
[F.A.Q.]
Q. I saw this exact thing (here) and (there)!
A. F.A.Q.'s are for questions only.
Q. Isn't this going a little far?
A. Possibly.
Q. Null boolexprs only leak with groups!
A. Nope. They leak with everything.
Q. And you are?
A. I am who I am.
Q. Freak.
A. F.A.Q.'s are for questions only.
Q. AceHarts F.A.Q.'s are better!
A. Still not a question.
[/F.A.Q.]
Ever since I learned JASS, I've been wondering about those boolexprs. Particularly the ones in trigger events. The thinking went, "Which is worse? A leaking boolexpr or the function calls needed to fix them?" So, I devised a plan to get rid of both. (If someone's done this before, stop me now.)
Why not store the boolexpr in a simple global variable? A fine plan, I thought. So, I experimented and replaced all my Filter(function True) with a more compact True. And it worked just as planned. Now, I decide to post it here .
JASS:
Simply inject the variable and the setup function and code into your Map Initialization library. There, we can now utilize the magic of the word True!
Now, instead of things like
JASS:
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_DEATH,Filter(function TrueFunc))
or
JASS:
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
we can simply put
JASS:
call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_DEATH,True)
No leaks, and a single extra function call throughout the game. Not so bad now, is it? Well, I do hope this helps optimize/simplify code for some people.
[F.A.Q.]
Q. I saw this exact thing (here) and (there)!
A. F.A.Q.'s are for questions only.
Q. Isn't this going a little far?
A. Possibly.
Q. Null boolexprs only leak with groups!
A. Nope. They leak with everything.
Q. And you are?
A. I am who I am.
Q. Freak.
A. F.A.Q.'s are for questions only.
Q. AceHarts F.A.Q.'s are better!
A. Still not a question.
[/F.A.Q.]