lua-users home
lua-l archive

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



On 11/09/2022 17:41, bil til wrote:
PS: To avoid stack overflow in such a "multiple table.remove", I would
propose to give back only the FIRST removed element.

  (who really is interestend in seeing all the removed elements? I
think this  would be quite a bizarre wish)

I second this.
Removing a lot of elements efficiently is very useful. Returning them all is really a corner case.

If one really needs those elements, they can be copied beforehand using table.move, anyway.

It would be very weird, semantics-wise, to remove elements to regain memory (for example) and getting an "out of memory error" (stack space) in doing so!



And to keep compatibility with indexing in other tyipcal lua functions
(e. g. table.move, also string.sub...) I would prefer not to give the
count, but to specify the first and last element to remove, so
table.remove( liist, i, [j]).

Am So., 11. Sept. 2022 um 16:07 Uhr schrieb bil til <biltil52@gmail.com>:
Thank you, this is really very "luaistic"... :).