Quick leak question (and an easy one ^,^)

GoGo-Boy

You can change this now in User CP
Reaction score
40
Since I began triggering I wasn't really sure whether the following leaks.

local unit creep
loop
set creep = FirstOfGroup(group)
exitwhen creep == null
call GroupRemoveUnit(creep)
endif

So is there a pointer or so leaking when I set the value of a unit variable to simple another unit without nulling the variable before?
 

ZakkWylde-

New Member
Reaction score
14
Since I began triggering I wasn't really sure whether the following leaks.



So is there a pointer or so leaking when I set the value of a unit variable to simple another unit without nulling the variable before?

I'm sure someone here more knowledgable will come in and blow my post out of the water (and I'll learn something new)...but I really don't see the difference between

[ljass]set u = unita

set u = null

set u = unitb[/ljass]

and [ljass]set u = unita

set u = unitb[/ljass]

of course if you're really unsure and none else responds to this thread, I would go ahead and null the unit (to be safe).
and it seems you have....extra lines of code? you have a loop for some reason...which, if you want the loop, requires an [ljass]endloop[/ljass]. I don't see, however, where the loop comes in...and currently you have an infinite loop (as far as I can tell) and a random [ljass]endif[/ljass] command (which should be used only if there is an [ljass]if[/ljass] command).
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
I'm sure someone here more knowledgable will come in and blow my post out of the water (and I'll learn something new)...but I really don't see the difference between

[ljass]set u = unita

set u = null

set u = unitb[/ljass]

and [ljass]set u = unita

set u = unitb[/ljass]
You're correct. The important thing is that the variable is null when the function returns.
 

jwallstone

New Member
Reaction score
33
Don't worry about it. Setting the variable to another unit means you don't have to set it to null first.
 
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