Originally Posted by stjobe
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.