Hashtables in simkin?

Topics regarding Scripting with Reality Factory
Post Reply
Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Hashtables in simkin?

Post by Jay » Wed Sep 24, 2008 11:40 pm

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.
Everyone can see the difficult, but only the wise can see the simple.
-----

User avatar
paradoxnj
RF2 Dev Team
Posts: 1328
Joined: Wed Mar 01, 2006 7:37 pm
Location: Brick, NJ
Contact:

Re: Hashtables in simkin?

Post by paradoxnj » Thu Sep 25, 2008 2:50 pm

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.
Many Bothans died to bring you this signature....

Allanon
Posts: 493
Joined: Mon Aug 29, 2005 8:23 am

Re: Hashtables in simkin?

Post by Allanon » Thu Sep 25, 2008 5:23 pm

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
Last edited by Allanon on Thu Sep 25, 2008 5:36 pm, edited 2 times in total.

Jay
RF Dev Team
Posts: 1232
Joined: Fri Jul 08, 2005 1:56 pm
Location: Germany

Re: Hashtables in simkin?

Post by Jay » Thu Sep 25, 2008 5:27 pm

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:
Everyone can see the difficult, but only the wise can see the simple.
-----

Post Reply