View Single Post
12-08-14, 03:07 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by myrroddin View Post
I think you have missed "tcontains", which is a table, but not defined anywhere.
No, "tContains" is a bad bloated function defined in Blizzard's UI code. While there may be some conceivable scenario where you really need to check if a value exists in an indexed table / array, this is not one of them; use a hash table instead:

Code:
local ignorezones = { [1152]=true, [1330]=true, [1153]=true, [1154]=true, [1158]=true, [1331]=true, [1159]=true, [1160]=true }
and a simple table lookup (instead of a function call + a loop + multiple table lookups + multiple equality checks):

Code:
  	  if ignorezones[instanceMapID] then
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote