[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: In place modification/assignment - A Patch
- From: "Robert G. Jakabosky" <bobby@...>
- Date: Sun, 26 Jun 2011 21:19:56 -0700
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:
> target.health -= 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