lua-users home
lua-l archive

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


On Jan 9, 2010, at 9:39 AM, Quae Quack wrote:

> table.pack seems a very strange function to me: its a one liner in lua, and shouldn't be any faster to code in C...
> ---------------------------------------
> function table.pack ( ... ) return { n= select ( "#",...) , ... } end

It's going to be faster in C because C tends to be much better at dealing with varargs. The Lua version has to pass the arguments down to another function call which will then just count the number of values it was passed.

Mark