lua-users home
lua-l archive

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

Michael Nelson <> wrote:

> On 1/2/2018 6:18 AM, Roberto Ierusalimschy wrote:  ...
>> As already explained, you can use _ARG; but you can use also any other
>> name:
>> function foo (...=a) print(a.n) end
>> _ARG is present both for compatibility (the above syntax will not even
>> compile in older versions) and for the main chunk (which does not have
>> a header to name this parameter).
> I just love the new syntax. I assume select will continue to work as
> usual, for old code and for use cases where it works better. The _ARG
> name makes the parameter name for the main chunk consistent with Lua
> _NAME practice, a good change. Any code broken by this last change should
> be an easy fix: a simple search and replace.

I have to agree, the new syntax for vargs will be nicer... and is something
I have mapped out for my hard fork of Lua using my Index data type. So, it
will be nice that both vanilla Lua and my Lua variant will now have the same
syntax potentially for varg access!

One thing I am curious about, Roberto, is the creation of tables to hold the
vargs. Won't this add significant overhead for the table allocations vs just
leaving the vargs on the stack?

I have downloaded the latest GitHub version and will peruse the diff from
5.3.4 to check out the changes. However, given that many Lua optimisation
tips seem to be centered around not creating unnecessary tables I just
wanted to ask that question now.

Is there any timeline for the next GitHub update and/or RC1 of 5.4?
No rush or anything, I am just asking out of curiosity! :)