lua-users home
lua-l archive

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

----- Original Message -----
Sent: Sunday, February 04, 2001 4:56 PM
Subject: More operators?


I have a question: How can I implement "arithmetic-assignment
operators"(not sure on the exact term) like += and /= ?
For clarification, a+=b is the same as a=a+b. However I've some users which
want to be able to do += directly.
This is not a bad idea. Python has just added (i think they are called) augmented operators eg. +=, -=, in v2.0 after prolonged argument.
I believe x += 1 would be faster for Lua than x = x+1, this is one of the reasons for adding it in Python besides convenience. ie. none mutable value becomes mutable in this case.

I've looked at the source, and the biggest obstacle I can see(I think) is
how to determine whether to use setglobal, setlocal, or settable for the