Hashtables, and you!

Status
Not open for further replies.
Level 10
Joined
Jan 21, 2007
Messages
576
Alright so once upon a time I learned jass but only enough to make simple chance on spell cast spells and the like, nothing advanced. So I never got a chance to use the H2I bug that is all the buzz right now.

Anyways I've got a few questions about the hashtable in accordance to gui.

1.) Why is it called hashtable, doesn't really matter just curious.
2.) Saving integer:
  • Hashtable - Save Value as Value of Value in (Last created hashtable)
Not really sure where to put what in that lol =/, I guess the whole point of this thread is for either someone to post an example of the hashtable in use or a link to a map that uses it.
 
Level 13
Joined
Nov 22, 2006
Messages
1,260
Hmm afaik hashtable behaves similarly to gamecache, except it's faster and safer and actually meant to be used like that.

When using H2I, you had to convert handles to integers in order to put them in a gamecache. When using handle variables (a really lame example, since nobody uses them anymore) you had to specify the handle you're attaching that value to, the value and the string to which that value was assigned (so you can get it later).

This works similarly, but I think it's using integers instead of strings, or something like that.

Er, yeah, this wasn't helpful much :p
 
Level 6
Joined
May 7, 2009
Messages
228
1.) Why is it called hashtable, doesn't really matter just curious.

Presumably because it is a hashtable.

Wikipedia said:
In computer science, a hash table or hash map is a data structure that uses a hash function to efficiently map certain identifiers or keys (e.g., person names) to associated values (e.g., their telephone numbers). The hash function is used to transform the key into the index (the hash) of an array element (the slot or bucket) where the corresponding value is to be sought.
Ideally the hash function should map each possible key to a different slot index; but this ideal is rarely achievable in practice. Most hash table designs assume that hash collisions — pairs of different keys with the same hash values — are normal occurrences, and accommodate them in some way.
In a well-dimensioned hash table, the average cost (number of instructions) for each lookup is independent of the number of elements stored in the table. Many hash table designs also allow arbitrary insertions and deletions of key-value pairs, at constant average cost per operation.[1][2]
In many situations, hash tables turn out to be more efficient than search trees or any other table lookup structure. For this reason, they are widely used in all kinds of computer software, particularly for associative arrays, database indexing, caches, and sets.



2.) Saving integer:
  • Hashtable - Save Value as Value of Value in (Last created hashtable)
Not really sure where to put what in that lol =/, I guess the whole point of this thread is for either someone to post an example of the hashtable in use or a link to a map that uses it.
I think DrSuperGood posted an example spell somewhere.
 
Level 10
Joined
Jan 21, 2007
Messages
576
Both of your guys posts were pretty helpful, thanks.

As for DSGs spell...
>.>
<.<
If anyone knows where that is that would be awesome lol, I'm looking for one atm...

EDIT: Found it, downloading now and gonna inspect it =p
 
Status
Not open for further replies.
Top