- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Suppose I have a location stored that is accessed by an array call.
This location gets used multiple times in a function. So I set a local variable to it to save some time.
After the function is done, do I need to remove the local location, or only null it, assuming I plan to keep the location in the array always.
From Vexorian's jass manual:
I would guess I would not destroy it, otherwise it would also destroy the value held in the array as well? I have doubts only because Vexorian calls it "roughly pass-by-reference."
Suppose I have a location stored that is accessed by an array call.
This location gets used multiple times in a function. So I set a local variable to it to save some time.
After the function is done, do I need to remove the local location, or only null it, assuming I plan to keep the location in the array always.
From Vexorian's jass manual:
all handle arguments (and handle subtypes) have roughly pass-by-reference semantics. In other words, modifying the "internals" of a handle variable, like a unit, passed to a function as an argument will alter the variable both within the callee function and the caller
I would guess I would not destroy it, otherwise it would also destroy the value held in the array as well? I have doubts only because Vexorian calls it "roughly pass-by-reference."
JASS:
...
local location myLoc = locations[i]
...
call RemoveLocation(myLoc) //should I make this call?, my gut says no
set myLoc = null