Troll-Brain
You can change this now in User CP.
- Reaction score
- 85
Maybe most of you already know but you can't store a "null" handle in an hashtable, neither an invalid handle, for example an handle which was destroyed but not setted to null.
I've just realized recently we can use that for safety checks.
Note that i'm perfectly aware about the priority of module initializer.
And yes, i could initialize the hashtable in the global declaration.
And ofc it might have better ways for specifics handles, like for units (GetUnitTypeId(<unit>) != 0)
What you think about that ?
A such library may exist ?
If it's really obvious, then amen, at least it wasn't for me
I've just realized recently we can use that for safety checks.
JASS:
library CheckHandles initializer onInit
globals
private hashtable HashT
endglobals
function IsGroupValid takes group whichGroup returns boolean
return SaveGroupHandle(HashT,0,0,whichGroup)
endfunction
private function onInit takes nothing returns nothing
set HashT = InitHashtable()
endfunction
endlibrary
Note that i'm perfectly aware about the priority of module initializer.
And yes, i could initialize the hashtable in the global declaration.
And ofc it might have better ways for specifics handles, like for units (GetUnitTypeId(<unit>) != 0)
What you think about that ?
A such library may exist ?
If it's really obvious, then amen, at least it wasn't for me