lua-users home
lua-l archive

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


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)