- Joined
- Jun 12, 2010
- Messages
- 413
It is known that if you don't null local handle variables at the end of a function, the reference counter to the handle is not updated. However, this is not the case for variables that are parameters for the function.
My question is, does this only apply if you don't change the value of the paramater variable, or does the reference counter get updated for the value the variable had when it went out of scope?
I know this seems like a pretty stupid question, but I just want to be 100% sure that this will work. The function is supposed to be called like this:
Thanks for your time.
My question is, does this only apply if you don't change the value of the paramater variable, or does the reference counter get updated for the value the variable had when it went out of scope?
I know this seems like a pretty stupid question, but I just want to be 100% sure that this will work. The function is supposed to be called like this:
JASS:
set YourUnit = GUDR_PlayerHasGeneratorSelected(YourPlayer, null)
Thanks for your time.
JASS:
function GUDR_PlayerHasGeneratorSelected takes player whichPlayer, unit firstOfGroup returns unit
local group slctGrp = CreateGroup()
call GroupEnumUnitsSelected(slctGrp, whichPlayer, null)
set firstOfGroup = FirstOfGroup(slctGrp)
call DestroyGroup(slctGrp)
set slctGrp = null
if HaveSavedHandle(udg_GUDR_Hashtable, GetHandleId(firstOfGroup), 0) then
return firstOfGroup
endif
return null
endfunction