[Solved] Hashtable do not save

Status
Not open for further replies.
Level 10
Joined
May 28, 2011
Messages
455
I cant find the solution for this problem
I want to save indexA (integer variable) in spell_hashtable (hashtable variable) but it doesn't.
After i load it and display its value. it appear 0.
Is something wrong?
 

Attachments

  • Hashtable leak.w3x
    19.1 KB · Views: 28
@WaterKnight; Why to waste a trigger to just initialize a Hashtable, when you could just do
[jass="OnSpellTrigger"]
// Set Hashtable
if (udg_MyHashtable == null ) then
set udg_MyHashtable = InitHashtable()
endif
// Other setups
[/code]

If the jass version is too much to understand... I'm writing a CS version.

  • -------- --------
  • Custom script: if ( udg_MyHashtable == null ) then
  • Custom script: set udg_MyHashtable = InitHashtable()
  • Custom script: endif
  • -------- --------
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Slightly, it does slow down the game but TC named the hashtable as spell_hashtable, so would assume wants to use it in other spell codes, too, therefore, pasting this everywhere, would create more lines/trash/take space. Besides, you normally also do other things on init, you do not have to use a private trigger for it, or you inject it into main function with jass (if InitHashtable works there).
 
Status
Not open for further replies.
Top