HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unset Gamecache Variable Returns What?

01-06-2009, 12:11 PM#1
Thunder_Eye
If I try to retrieve data from a gamecache that I've never stored anything into, what will I get returned? 0? null? error?

Collapse JASS:
set i = GetStoredInteger(theGamecache, "Something", "Something")

What would i be assigned as if I never stored anything as "Something", "Something"?

I tried a search but didn't find anything about it.

EDIT:
I think I actually found something related to this problem, however, it says GetStoredXXXX returns 0. How does that work for strings?
01-06-2009, 12:17 PM#2
C2H3NaO2
I think for integers it returns 0.
You should just test it by yourself.

There is also a function that checks if a value is set for the key pair:
HaveStoredInteger/HaveStored<Type>
01-06-2009, 12:21 PM#3
Thunder_Eye
Yes I noticed that, but what does strings return?

Hmm I'll just test it myself.

EDIT: It returned "", thanks for the tip on the functions though
01-06-2009, 01:08 PM#4
DioD
There is some fun with string return.

It actually return null as string.
01-06-2009, 06:25 PM#5
Archmage Owenalacaster
Nice to know it doesn't crash. Could be useful information for passing data between AIs through gamecache.
01-07-2009, 08:11 AM#6
DioD
There is PriceServer and PriceServerAI on wc3jass.com for this.

Passing data is not instant.
01-07-2009, 09:43 AM#7
Blackroot
Cached values default to null, 0, and "" respectively.