Thread: KGPanels script
View Single Post
11-10-14, 12:59 AM   #28
Choonstertwo
A Chromatic Dragonspawn
 
Choonstertwo's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 194
Originally Posted by suicidalkatt View Post
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 View Post
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).
  Reply With Quote