• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Hashtable Save & Load Question

Status
Not open for further replies.
Level 1
Joined
Sep 18, 2018
Messages
1
I recently started playing around in the wc3 editor again, and I'm clearly missing something about how hashtables work in wc3:
JASS:
    call DisplayTextToForce( GetPlayersAll(), "Hero Spawn! hero:"+GetUnitName(hero))
 
    call SaveUnitHandle( udg_heroTable, GetHandleId(switch), 0, hero)
    set hero2 = LoadUnitHandle(udg_heroTable, GetHandleId(switch), 0)

    call DisplayTextToForce( GetPlayersAll(), "Hero Spawn! hero:"+GetUnitName(hero2) )
When this is run in game the first text displayed is "Hero Spawn! hero:somename" while the second is "Hero Spawn! hero:". Why does the second DisplayText not display the same thing as the first? It seems like hero2 doesn't even point to a unit, and certainly not the one that hero points to, but I don't see how that's possible. hero and hero2 are both local unit variables.

Perhaps a clearer question would be: What do the SaveUnitHandle and LoadUnitHandle functions even do, exactly?
 
Status
Not open for further replies.
Top