lua-users home
lua-l archive

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


----- Original Message ----- 
From: "Jason Clow" <ih8msft@kmfms.com>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Wednesday, March 28, 2001 5:56 PM
Subject: Re: +=


> How would one go about implementing operators such as
> +=, -=, ++, etc? I use x = x + something_else quite a lot,
> and having x += something_else would make my code look so
> much cleaner, imho. Is there a way to do it with Lua code
> (like tag methods), or will it have to be added to the parser?

Can't you do something like x:add(something)? And then implement
the add-thing with a tag method or something. You could have
x:multiply(something) etc. as well...

Just a thought.

--

  Magnus Lie Hetland         http://www.hetland.org

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick