[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ++ and +=
- From: Rob Kendrick <rjek@...>
- Date: Wed, 19 Feb 2014 17:13:25 +0000
On Wed, Feb 19, 2014 at 08:56:32AM -0800, Steven Mak wrote:
> Hi all,
>
> Can I know why there is no such operators as ++ or += (or similarly others like string concatenation) in Lua? What are the better alternatives instead of writing it in full "x = x + 1" or "this_string = this_string .. "Another string ""?
An age old question. The trick is to set up some macros/snippets in
your text editor if you want to save the handful of keypresses. (I'm
surprised neither of the FAQs cover this.)
As for why they don't exist, there are some interesting corner
cases/possible surprises related to metamethods that are entirely
avoided by being specific.
B.