[Solved] Setting Hastable Value to...nothing?

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2012
Messages
204
Hey guys,

Is there a way to set a hashtable value to...nothing... basically (to clear it).

What i want to do is clear a saved Handle of a Unit out of the Hastable so when i check for "is equal to NoUnit" it triggers again...

i tried this:
  • Hashtable - Save Handle OfNo unit as Grp_temp_int of (Custom value of (Casting unit)) in Grp_UnitHash
but it doesnt work...i guess because im telling him to save nothing...so he does xD

greetings
CodeBlack
 
You'll probably have to combine the following JASS functions in order to do what you want
JASS:
    native RemoveSavedHandle takes hashtable table, integer parentKey, integer childKey returns nothing
    native HaveSavedHandle takes hashtable table, integer parentKey, integer childKey returns boolean

    [...]
 
    // Flush handle data from the table
    call RemoveSavedHandle(udg_Grp_UnitHash, GetUnitUserData(GetTriggerUnit()), udg_Grp_temp_int)
 
    // If there's no handle stored here
    if not HaveSavedHandle(udg_Grp_UnitHash, GetUnitUserData(GetTriggerUnit()), udg_Grp_temp_int) then
        // Do stuff
    endif
 
You'll probably have to combine the following JASS functions in order to do what you want
JASS:
    native RemoveSavedHandle takes hashtable table, integer parentKey, integer childKey returns nothing
    native HaveSavedHandle takes hashtable table, integer parentKey, integer childKey returns boolean

    [...]
 
    // Flush handle data from the table
    call RemoveSavedHandle(udg_Grp_UnitHash, GetUnitUserData(GetTriggerUnit()), udg_Grp_temp_int)
 
    // If there's no handle stored here
    if not HaveSavedHandle(udg_Grp_UnitHash, GetUnitUserData(GetTriggerUnit()), udg_Grp_temp_int) then
        // Do stuff
    endif

alright :)
This did the Trick:
  • Custom script: call RemoveSavedHandle(udg_Grp_UnitHash, GetUnitUserData(GetTriggerUnit()), udg_Grp_temp_int)
i used it as custom Code since im trying to keep it as "jass free" as possible...

Thanks a lot! +rep
 
To emphisize what Tasyen said, the function...
JASS:
native FlushParentHashtable takes hashtable table returns nothing
Is actually the hashtable destructor. It will effectively destroy the passed hashtable, making it unable to be used ever again. This is clearly a case of incorrect naming that can confuse.
 
Status
Not open for further replies.
Back
Top