lua-users home
lua-l archive

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

On 27 June 2011 05:19, Robert G. Jakabosky <> wrote:
On Sunday 26, Ian Millington wrote:
> A while back I posted a commercial job offer for someone to help add
> in-place mutation operators to Lua (+=, -=, *=, /=, %= and ^=). My
> domain is in a scripting language for games, and a good deal of the
> lua scripts consist of changing variable values, such as:
> -= 2
> player.ammo.shells -= 1
> so this saves a *lot* of typing.

Also with the added metamethods "__add_eq","__sub_eq",etc...  This can help
improve the speed of vector/matrix code, by removing the need for temp.
objects to be created as the results of every arithmetic operation.

-- this tells the compiler that you want to add one vector into another,
-- modifying the value of 'vec1'
vec1 += vec2

> Robert Jakabosky helped me out with the project (for the record, he's
> good, hire him ;)),

Thanks for the recommendation.  Also it was a pleasure working with you.

> and I want to contribute the code he built for me
> back to the community. The patch is below, a patch off 5.1.4 (it
> applies clean with "git apply" for me). I have added this to the Lua
> Power Patches page at

Here is the direct link to the patch you uploaded:

> But I didn't quite know how to fill out the "Lua authors' position" field
> :)

Most of the patches don't have anything for that field, so just put "?" for

Robert G. Jakabosky

Thank you for making this compound assignment patch available for everyone to use, I only hope it makes it into the Lua core as it is enough of a reason to use a version patched for this feature.

Thank you