I have some questions about JASS local variables. I know I need to set Handle objects to null. I guess this lets the game know they are no longer being used so the memory for the pointer is freed. Do I also need to set integers / reals to 0, strings to empty string, etc?
Also let's say I have a trigger like this:
Will this leak? Do I need to put "set u = null" outside the if statement or is it fine like that?
How does it work if I do:
Would that leak? How would I deal with it otherwise? Would I need to use a global and use that elsewhere? - basically removing the return in place of using the global.
Thanks in advance.
Also let's say I have a trigger like this:
JASS:
function test takes nothing returns nothing
local unit u
if (false) then
set u = GetTriggerUnit()
// Do stuff
set u = null
endif
endfunction
How does it work if I do:
JASS:
function test takes nothing returns unit
local u = GetTriggerUnit()
return u
endfunction
Thanks in advance.