View Single Post
01-17-13, 12:04 PM   #2
Barjack
A Black Drake
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 89
I'd say that thinking about how often that table lookup is happening is probably the best way to evaluate whether making a local is necessary or not (although even readability might be important). For something like a set-up function that runs once on PLAYER_ENTERING_WORLD, or something that happens when the player changes the settings on something, or does something infrequent like opening a bank or getting a whisper, I definitely don't think it matters. On the other hand, if that lookup has the potential to happen 10 times per function in a function that might happen 20 times per second during combat, then I personally would definitely consider making it local.
  Reply With Quote