lua-users home
lua-l archive

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


On Mon, May 2, 2011 at 5:44 PM, Fabien <fleutot+lua@gmail.com> wrote:
>
>
> On Sun, May 1, 2011 at 2:10 AM, Ian Millington <idmillington@gmail.com>
> wrote:
>>
>> Task: Extend Lua to add mutator assignments: (+=, -=, etc: we need the
>> six numerical operators, but clearly once one is done, the pattern
>> should be pretty trivial for me to copy).
>
> Metalua supports these out of the box.

But it does not use metamethods. I expect that half of the goal here
is to have efficient += for C types based on an __addeq metamethod.
Generating bytecode for calling a custom metamethod is rather knarly,
involving calls to debug.getmetatable and so on -- it would be much
cleaner and faster to have a new ADDEQ opcode.