[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: inadequate documentation for select and table.unpack
- From: Dirk Laurie <dirk.laurie@...>
- Date: Mon, 20 Jun 2016 19:43:19 +0200
2016-06-17 18:49 GMT+02:00 Viacheslav Usov <firstname.lastname@example.org>:
> These functions are officially part of Lua's standard libraries. However,
> except in their own subsections, they are not mentioned in the reference
> manual, and their own subsections have no useful keyword like "vararg" and
> "multiple results". The free version of the Lua book is obsolete in this
> When you know how and when these functions are used, then the manual
> makes perfect sense. But if you do not, then you cannot even find them
> there (except by reading it through). I would say that some examples and
> cross-references would be very helpful.
My most-visited page by far in the whole manual is the index.
Every new release, I reread that page and try to find something that
was not there before. It has had both 'select' and 'table.unpack' for
some time. But sure, both of them could fit in nicely in §3.4.11 when
vararg expressions are discussed.
A point that does rate some extra explanation, but perhaps iin PiL
rather than the reference manual, is that 'select' is in fact an
extremely efficient operation, involving no actual copying of
arguments. There is no API equivalent, because none is needed.
It returns the stack exactly as it found it, but reporting a possibly
different number of return values.