- Home /
Finding if a specific key contains a specific value in a Hashtable?
Is is possible to check if a Hashtable contains a specific key with a specific value?
For example, if I had something like:
var table : Hashtable;
table = new Hashtable
({
"Backstab" : 1
});
How could I check if the Backstab key contains a value of 1, so that if it does, I do something. The scripting reference says I have ContainsValue(which simply checks the entire Hashtable for a specific value), ContainsKey(which simply checks the entire Hashtable for a specific key), and Contaisn which is the same as ContainsKey. Seems to be no options to find whether a specific key contains a specific value. Can anyone help me out with this?
Answer by liamcary · Mar 07, 2013 at 05:23 AM
in C# you can check it using
if(hashTable["key"] == "value"){}
JS is usually the same or very similar.
Your answer
Follow this Question
Related Questions
Need help with my script 0 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer