lua-users home
lua-l archive

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




On Thu, Oct 10, 2019, 09:50 Egor Skriptunoff <egor.skriptunoff@gmail.com> wrote:
On Thu, Oct 10, 2019 at 2:54 PM Soni L. wrote:
it'd be nice to have a limit() function companion to select() where select skips the first n and limit skips everything after n.

e.g. limit(1) --> nothing, limit(1, 1, 2, 3) --> 1, etc



1) Please note that you can get the last N elements by invoking
select(-N, ...)
You probably can change the order of parameters in your functions to switch from "get first N" approach to "get last N".

Yes I can use a coroutine to reverse the order, use select, then use another coroutine to reverse the order again.


2) Why asking for introducing new function instead of overloading old one?
For example:
select("range", 2, 3, "a", "b", "c", "d")  -->  "b", "c"

Uhh no


3) Extracting a subtuple from a tuple would be practically useless without ability to concatenate tuples.

We don't have tuples.