lua-users home
lua-l archive

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


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
> 
> http://lua-users.org/wiki/LuaPowerPatches

Here is the direct link to the patch you uploaded:
http://lua-
users.org/files/wiki_insecure/power_patches/5.1/compound_operators_5.1.4.patch

> 
> 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 
now.

-- 
Robert G. Jakabosky