lua-users home
lua-l archive

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


On Mon, May 02, 2011 at 11:21:05AM +0200, Xpol Wan wrote:
> As a beginner of Lua, I do think  select("#", ...) is not elegant enough.
The moment something in Lua is not elegant, it usually means that
one should not be doing it that way.

I can think of only one unavoidable application for  select("#", ...),
unfortunately one for which an example is to be found in the standard
library (table.insert), and that is when the calls
    myfunc(a,b)
    myfunc(a,b,nil)
involve different semantics for a and b.

A beginner of Lua would do well to avoid writing such functions.

Dirk