• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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