Antares
Spell Reviewer
- Joined
- Dec 13, 2009
- Messages
- 982
Hello,
quick question. I want to put a cooldown on damage taken from a source by flipping a boolean in a hashtable at parentKey source and childKey target from false to true to store that the cooldown is active. The code surrounding it would look like this:
The important point is that I never actually save "false" at position (whichParticle , playerNumber). In good old JASS-fashion, you would expect that the thread crashes on the first line in Damage, but it doesn't and it returns false. This is actually great because it saves me spamming the hashtable with a lot of entries. So, my question is, is there any downside to doing it like this? Can you use hashtable entries in which nothing was written yet as false, 0, and/or null without any problems?
quick question. I want to put a cooldown on damage taken from a source by flipping a boolean in a hashtable at parentKey source and childKey target from false to true to store that the cooldown is active. The code surrounding it would look like this:
JASS:
function Reset takes nothing returns nothing
//Do stuff.
call RemoveSavedBoolean( particleTable , whichParticle , playerNumber )
endfunction
function Damage takes nothing returns nothing
if not LoadBoolean( particleTable , whichParticle , playerNumber ) then
//Do damage stuff.
call SaveBoolean( particleTable , whichParticle , playerNumber , true )
endif
endfunction
The important point is that I never actually save "false" at position (whichParticle , playerNumber). In good old JASS-fashion, you would expect that the thread crashes on the first line in Damage, but it doesn't and it returns false. This is actually great because it saves me spamming the hashtable with a lot of entries. So, my question is, is there any downside to doing it like this? Can you use hashtable entries in which nothing was written yet as false, 0, and/or null without any problems?