Calling a function is pretty much the slowest thing you can do. It's even faster to do three table lookups:
Code:
local color = { 1, 0, 1 }
local r, g, b = color[1], color[2], color[3]
... than to do one function call:
Code:
local color = { 1, 0, 1 }
local r, g, b = unpack(color)
... even if you've upvalued the function.
Since
select can be avoided in pretty much every single case, you should avoid it. Do this:
Code:
local _, _, _, _, _, var = GetSomeValues()
print(var)
... instead of this:
Code:
print((select(6, GetSomeValues()))
The former may be "more code" but it's faster, and more readable, and definitely more efficient if you're using other values returned by the same function -- I've seen some addons where the same function is called multiple times in a row, wrapped in different
select calls. Huge waste of CPU time.