The hash table acts as a list, a list of expression that will match something (words). I used regular expressions (regex) to match words.
With hash table, you associate a value (data) to an item.
Because of the syntax "/hadd <table> <item> <data>", we can't use spaces for the item's name so I used the data.
For example, the regular expression /\b(word1)\b/ matche a word "word1". To know if it matches, you typcally use the $regex function, $regex(word1,/\b(word1)\b/) is 1 because the expression matches the string, the word "word1" is found.
$hfind is typically used one way: you want to know if something matches an item/data:
If you execute in your editbox:
//hadd -m test item data | echo -a $hfind(test,*te*,1,w) | hfree test
you get "item", because the wildcard expression *te* matches "item", $hfind(test,*at*,1,w).data would match "data" (the .data property makes it look into the data, not the item), note though that $hfind always return the item name so it would actually return 'item' when founding "data".
In the above examples, we pass a wildcard expression to $hfind that is compared against the items (or datas) of the table, in the script I gave, we use the parameter 'R', it indicates that, this time, the items (or datas) are the expressions:
//hadd -m test /\b(item)\b/ /\b(data)\b/ | echo -a $hfind(test,this is a long sentence with the word item in it,1,W) | hfree test
would return "/\bitem\b/" because that item name, representing a regular expression, matches the string provided.
$hfind does all the job basically.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel