• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Hashtable key maximum size?

Status
Not open for further replies.
Level 4
Joined
Jan 27, 2016
Messages
89
Is there a maximum size to a hashtables key and if so, how much?

Whats stopping me from just converting the following strings to integers and using them

[(UnitID1)][(UnitID2).2]
[(UnitID1)][(UnitID2).3]

Basically using periods to seperate pieces of input data into the hashtable and having multiples of them, sort of simulating multidimensional arrays? Realistic Example of a hashtable that saves a lot of units to its number that fit certain criteria,
[Number][Criteria1.Criteria2.Criteria3]
where in this case, criteria 1 is, is the unit flying, 2 is is it undead, 3 is its level above 3
save number of those units into 0
and then loop from 0 to whatever the number above is for all those units
 
Sounds like a waste.
There are too many alternatives for multidimensional arrays to be truly useful, at least in wc3 modding.

At times, I'd prefer a 2D array-like syntax which translates to hashtables on compilation. But that's about it, otherwise I would not see much use in it.
I think vjass has support for 2d arrays, by the way.
 
Is there a maximum size to a hashtables key and if so, how much?
Maximum -> 2,147,483,647
Minimum -> -2,147,483,648
Whats stopping me from just converting the following strings to integers and using them

[(UnitID1)][(UnitID2).2]
[(UnitID1)][(UnitID2).3]
Neither of those strings contain reasonably resolved integers. As such some internal error will occur and likely 0 will be returned.
Basically using periods to seperate pieces of input data into the hashtable and having multiples of them, sort of simulating multidimensional arrays? Realistic Example of a hashtable that saves a lot of units to its number that fit certain criteria,
Hash tables take integers and not strings.

If you are referring to taking a hash of a string using the hash native then you run the risk of hash collisions occurring. Let us not forget that all unique strings leak as there is no garbage collection for strings.
 
Status
Not open for further replies.
Back
Top