Originally Posted by suicidalkatt
It's simply checking if the event is in the table. It should still return valid.
|
When you use the array-style table initialiser, the keys are numeric starting from 1 and the values are the values listed (the event strings in this case).
When you use the square bracket indexing operator, you're looking up the value associated with that key. In this case, you're looking up the value of the event name string, which is always nil because the event names are values rather than keys.
Originally Posted by suicidalkatt
Alternatively you could do this as well:
|
That would work, but tContains iterates through the table until it finds the specified value. A simple key lookup is more efficient (although the difference is probably measured in milliseconds here).