mIRC Homepage
Posted By: AWEstun Hash search problem - 10/06/08 11:44 AM
Thanks qwerty. As you said, I replaced the hash name iptracker to %hash and it works once again. Originally I wrote the alias specifically for iptracker, but I modified it to be able to use it on other hashes.
Posted By: qwerty Re: Hash search problem - 10/06/08 12:02 PM
You seem to be lacking error checking: you are assuming that %b is always set, that is, every match in the iptracker table will have a corresponding match in the %hash table. Apparently that's not the case, so you should check whether %b is $null before you use it further.

Apart from that, there's something that doesn't look quite right:

set %c $hget(%hash,%a).data

What this does is retrieve the value of the %a-th item in %hash. Since hash tables are not ordered in any meaningful way, and that order changes as you add items, you most probaby do NOT want to access a hash table in that way. What you seem to need is the value of the item in %b. That's just

set %c $hget(%hash,%b)

I'd suggest you experiment with hash tables before trying to use them in "production": start out with simple example tables and test what each hash table-related identifier returns for various parameters you pass it, in order to get a good grasp on their function.

© mIRC Discussion Forums