lua-users home
lua-l archive

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


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".

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

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