- Joined
- Aug 22, 2013
- Messages
- 13
I've found a surprisingly small amount of information on what exactly the HashTable is in JASS and I have a few questions.
I'm familiar with Java and C++, so if you can explain it in terms of the standard libraries of either of those languages that would be great. At first I was thinking that this was just like a Map<Integer, Handle> but it seems that there are two keys (parentKey and childKey) so I'm not sure how to relate that.
Also, creating local hashtables doesn't seem that useful as you would not have access to them in other scopes. Is it common to use a global hashtable for each spell that needs one? Or would you use a global hashtable that stores your hashtables for each spell?
JASS:
function HandleExample takes nothing returns nothing
local hashtable t = InitHashtable()
local unit u = GetTriggerUnit()
// what are parentKey and childKey?
SaveUnitHandle(t, parentKey, childKey, u)
endfunction
I'm familiar with Java and C++, so if you can explain it in terms of the standard libraries of either of those languages that would be great. At first I was thinking that this was just like a Map<Integer, Handle> but it seems that there are two keys (parentKey and childKey) so I'm not sure how to relate that.
Also, creating local hashtables doesn't seem that useful as you would not have access to them in other scopes. Is it common to use a global hashtable for each spell that needs one? Or would you use a global hashtable that stores your hashtables for each spell?