[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: [FUN] A bit of code golfing
- From: <Tomas.Lavicka@...>
- Date: Sun, 2 Oct 2016 06:27:01 +0000
Because sometimes you need to use real negative indexes.
-----Original Message-----
From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Martin
Sent: Sunday, October 02, 2016 2:14
To: Lua mailing list
Subject: Re: [FUN] A bit of code golfing
On 16-09-30 01:38 PM, Egor Skriptunoff wrote:
> Unlike the "string" library, "table" library DOES NOT have the
> possibility to use negative indexes for counting backwards from the
> end of a table.
By the way I can't find reason why not implement that semantic trick with negative index for sequence functions.
I think it will be harmless and useful (at least for me, as I don't like to remember which element table.remove() removes by default and prefer to write
table.remove(some_table_name.subtable, -1)
instead of
table.remove(some_table_name.subtable, #some_table_name.subtable)
)