lua-users home
lua-l archive

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


On 13.08.19 06:45, Sean Conner wrote:
> 	veryLongNmae[complexLValue] = veryLongName[complexLValue] + 1

every time I type the above line, I wish Lua had the += operator. It depends on
the kind of program, but in some use cases (e.g. statistically evaluating large
data files) I need to type this kind of line frequently.

> 	veryLongName = trim(x,@,z)
> 	line = @:gsub('%s+',' ')
> 	veryLongName[complexLValue] = @ + 1
>
> This still shows the assignment, which in my book is still important. And
>   I'm not sure if I like it though.  Part of me loves the idea of not having
> to type "veryLongName[complexLValue]" several times (avoiding typos), but
> the other half of me keeps saying "You hate Perl and it's implicit magic ..."

yes, interesting idea, but I also think that this would be too magic. I would
prefer simple +=. I know from time to time this comes up in this list but I
never understood why Lua does not have +=.

-- Oliver