Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mitchelq on March 27, 2014, 03:43:30 PM
-
Hello,
I'm trying to get the key of a hashtable by searching for a specific value, but I can't seem to find a way to do this.
I can do it the other way (by searching for a key and then getting the value of the key) but it seems impossible to get the key?
Example what I mean:
Keys / Values
enemy 1 / 10
enemy 2 / 15
enemy 3 / 12
enemy 4 / 8
I would like to get the highest number. I can get that by making an array of the values and sort it, but then I will still need to get the key to see which enemy it belongs to. The numbers/values do change every now and then.
Love to get some help on this.
Thanks in advance!
Best regards,
Mitchel
-
I found a way to go around the problem.
I now create an array from my hashtable which I sort, revert en get the highest value from. After this I go through my hashtable with the get next action and store the value as a variable which I compare to my highest value. If it matches I use the key and if not go to the next.
Not completely the right solution, but for now it works. If anyone has a better solution I'm still happy to hear so.
Thanks,
-
Hi,
It's all ok apart from the getting the key from the value on a hashtable. use "HashTableGetKeyFromValue" instead.
bye,
Jean