View Single Post
05/12/14, 07:44 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Originally Posted by stjobe View Post
The correct way (which I just learned and want to share) of getting the last value from GetUnitBuffInfo() is using select():
Actually, using select() is more expensive (since it's a function call) than just assigning the values - that are already returned anyway, even in the select() call - to a throwaway variable. If your code is only called once, or not very often, then you can use select() if you think it makes your code easier to read and follow. But I would use throwaway variables if it is called in an event that fires often or in an OnUpdate script.

------

Clearing out a table still leaves an empty table behind, which you can reuse. Depending on the size of your table and how often this is done, you should weigh the pros and cons of clearing and reusing a table as compared with just creating a new table and letting the garbage collector pick up the old one on the next pass.
  Reply With Quote