lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 16-06-23 04:48 AM, Viacheslav Usov wrote:
> 1. (More important) The reference manual should point out that {...} is
> the best way, overall, to deal with variadic arguments, and select is
> deprecated.

You ignore memory allocation. As I understand, select(i, ...) requires
constant amount of memory while "{...}" allocates table and consumes
memory proportional to length of "...".

For example in World of Warcraft lua API there are many sick functions
which returns dozens of results. Instead of single table with results.
Maybe just because it's faster in C and does not create table which will
occupy memory till next garbage collection.

Also if your addon needs just couple of these results you'd better to
use select(). Again, to avoid creating temporary table which will occupy
memory.