View Single Post
01-17-13, 02:18 PM   #3
Aanson
A Flamescale Wyrmkin
Join Date: Aug 2009
Posts: 124
Originally Posted by Barjack View Post
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.
Yeah, that's perfect Barjack, thanks. That was pretty much the way my thinking was going. If it was OnUpdate, I'd define each frame from the table as a local at the start of the function without question, but for anything else that isn't used as often, it's not really all that important, unless I need to reference the frame a significant number of times (which never really happens).

Thanks again. I think I just needed reassurance

Aanson.
__________________
__________________
  Reply With Quote