• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] SaveUnitHandle bug

Status
Not open for further replies.
I have these lines:

JASS:
    call SaveUnitHandle( udg_hashtable, GetHandleId(orderunit), udg_BatalionHash_TargetUnit, null )
    
    set orderunit = LoadUnitHandle( udg_hashtable, GetHandleId(orderunit), udg_BatalionHash_TargetUnit )
    call BJDebugMsg(GetUnitName(orderunit))

I get output with a unit name which was recently targeted, even though I nullified its handle in hashtable. I can store another unit, but I can't empty it for some reason. :S
 
How can I flush them? It clears the whole hashtable?

Xonok is correct. Simply use:
JASS:
native  RemoveSavedHandle                                       takes hashtable table, integer parentKey, integer childKey returns nothing

e.g.:
JASS:
call RemoveSavedHandle( udg_hashtable, GetHandleId(orderunit), udg_BatalionHash_TargetUnit)

And that will clear up the reference in the hashtable.
 
Status
Not open for further replies.
Top