Another Simple Question: Get...Unit() leak?

newtonrox

Member
Reaction score
2
by Get...Unit(), I mean:
GetTriggerUnit(), GetFilterUnit(), GetEnteringUnit(), GetEnumUnit() and etc..

does any of Get...Unit() leaks? Do I have to assign a local unit variable everytime i use those? like:

local unit U = Get...Unit()
set U = null

or ppl do that just because it's faster, when you use it more than once, in a function?
 

Joker(Div)

Always Here..
Reaction score
86
the variable
[ljass]local unit U = GetTriggerUnit()[/ljass] will leak if the unit is removed and the reference is not nulled, but just GetTriggerUnit() itself does not leak.
People use variables for readability. The speed difference is insignificant.
 

ZugZugZealot

New Member
Reaction score
33
Yes, a major thing is readability. However, it DOES make a difference in performance IF there is more than one time in the function that you need to access the data. If it's to reduce function calls, then it's well worth it. Well, significance really depends on how many times it's fired/looped, and how taxed your game/map is, as is. If you do something as simple as move a unit a handful of times, the performance difference won't be noticeable.
 
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