lua-users home
lua-l archive

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


> On Fri, Jul 14, 2017 at 2:10 AM, Roberto Ierusalimschy <
> roberto@inf.puc-rio.br> wrote:
> 
> > The syntax
> >
> >   function foo (a,b,c)
> >
> > can be considered basically a sugar for
> >
> >   function foo (...)  local a,b,c = ...
> 
> There is more than sugar to that, because there is a distinction between a
> vararg and non-vararg function in Lua:

Yes. That is why there was a "basically" in my sentence... (In your
nitpicking, you forgot to mention that the debug information is also
different in the two versions :-)

Anyway, my point was that it is not "Lua" who does the adjustment, it
is the function itself. Adjustment is not a general property of the
language, but a property of non-vararg Lua functions, which do
the adjustment when they do the equivalent to that initial assignment.
(Not by change, the adjustment of parameters follows exactly the
rules for adjustment in assignment.)

-- Roberto