Page 1 of 1

Hashtables in simkin?

Posted: Wed Sep 24, 2008 11:40 pm
by Jay
In a tutorial by Greywolf i read about hashtables in simkin. But the section wasn't finished. Does anyone know more about this topic?

An explanation what a hashtable is:

A hashtable is like an array, but with strings instead of numbers. A normal array gives each element a number and it has a value. In a hashtable, each element has a name instead of a number. The cool thing about a hashtable is that it organizes the data in a way that is just as fast as a normal array, but way better to read.

I would really like to use hashtables to organize my items and character abilities better.

Re: Hashtables in simkin?

Posted: Thu Sep 25, 2008 2:50 pm
by paradoxnj
Hash tables don't necessarily need strings as their keys. A hash table uses a hashing function to make your string into a unique number that is then put into a vector (array). When you do a lookup, the string you supply is hashed into a number which should match the entry in the vector. This is why hash tables are faster than normal arrays and maps.

As for Simkin, I would gather that you can export any functions related to hash tables using Simkin. Simkin does not have a built in hash table variable. I can't seem to find one in the documentation at least.

Re: Hashtables in simkin?

Posted: Thu Sep 25, 2008 5:23 pm
by Allanon
I've never scriped using Simkin but I did a search and found THIS in the Simkin documentation. Not sure if it will help.

EDIT: You can also look here to find more hash table classes:
http://www.simkin.co.uk/Docs/cpp/api/classes.html

Re: Hashtables in simkin?

Posted: Thu Sep 25, 2008 5:27 pm
by Jay
paradoxnj wrote:Hash tables don't necessarily need strings as their keys. A hash table uses a hashing function to make your string into a unique number that is then put into a vector (array). When you do a lookup, the string you supply is hashed into a number which should match the entry in the vector. This is why hash tables are faster than normal arrays and maps.
I knew that, just wanted to put it a bit simpler :wink: