lua-users home
lua-l archive

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

Benoit Germain <> writes:

> Hello,
> Currently, when a vararg function needs to know the number of vararg
> parameters it got, one must use
> select( '#', ...)
> On the other hand, the seemingly innocent idiom
> local n = #...

> I find rather awkward to be obliged to resort to a function call just
> to be able to count the number of elements or to extract one such
> element in a language construct when the VM has all the required
> information.

What makes you think the former is a function call and the latter not?

> It also breaks my heart when I think about all the stack adjustments
> that go on under the hood just because of that function call :-).

Have you actually looked at the generated byte code?

David Kastrup