[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: t[] = 'syntactic sugar'
- From: Rebel Neurofog <rebelneurofog@...>
- Date: Thu, 19 Jan 2012 15:05:01 +0300
On Thu, Jan 19, 2012 at 3:58 PM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2012/1/19 Leo Razoumov <slonik.az@gmail.com>:
>> On Thu, Jan 19, 2012 at 04:40, Egil Hjelmeland
>> <privat@egil-hjelmeland.no> wrote:
>>> Has it been considered:
>>> t[] = 'syntactic sugar'
>>> be syntactic sugar for
>>> t[#t+1] = 'syntactic sugar'
>>>
>>> , like in PHP?
>>>
>>
>> This shortcut would be useful. Typing
>>
>> my_long_descriptive_table_name[#my_long_descriptive_table_name + 1] = val
>>
>> can be quite tedious.
>>
>
> I'm breaking a New Year's resolution … oh well it lasted 19 days …
> "Don't pour cold water on cute suggestions to improve Lua" …
>
> append = table.insert -- I do this anyway in just about every program I write
> ...
> append(my_long_descriptive_table_name,val)
>
Ain't that much slower?
I like [# + 1]. Seems that it wouldn't be too hard to implement...