Warning: this is a fine point of optimization, and I suspect that the difference is purely academic.
That said, when you only need one of the returns from a function with multiple returns (i.e. return var1, var2; ), which of these is better, memory-wise and/or CPU-wise:
This one, which seems to be the preferred way of doing it now:
Code:
local someVar = select(2, SomeFunction())
or this one, which I used to see in older code:
Code:
local _, someVar = SomeFunction()
The only reason I'm asking is that I typically figure that avoiding function calls if you don't need them is a good idea, but most good code that I've looked at lately uses select().
I'd appreciate any light anyone can shed on this. Thanks in advance.