• 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.

[JASS] Nulling variables quick question

Status
Not open for further replies.
Level 5
Joined
Sep 19, 2006
Messages
152
Is it a good practice to null a handle like u = unit before reassigning u to another unit (as in a loop), or is this unnecessary?

loop
set u = FirstOfGroup (g)
call RemoveUnit (u)
set u = null*
endloop
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
function something takes whatever you want returns whatever you want
some locals
do whatever you want
null locals
endfunction

Tip: It doesnt mean that "you dont need to null something in a loop so you dont have to destroy something in a loop too"


[jass="The Point of Existance"]loop
set loc = Somewhere in Matrix
exitwhen wheneveryouwant
call DoSomethingWithLocation(loc)
call RemoveLocation(loc)
call DebugMessageBJ("Your Location has been Destroy3d By Triggers")
dontendtheloop[/code]
 
Status
Not open for further replies.
Top