lua-users home
lua-l archive

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

Hi, I'm passing along a question from a colleague, related to our project with Lua.
We're trying to tweak Lua 4.0 to our needs.


I am implementing a "->" operator in Lua 4.0, whose function is to be the same of "[]"
and "." operators, but additionally, it should duplicate the left-hand side as the first
argument of the method (which is at the right-hand side of the "->")


   instance.method( instance, arg1, arg2 );

with operator "->" would become:

  instance->method ( arg1, arg2 );	// "instance" passed implicitly

The problem is that I don't know how to do that duplicate. I'd like to see a complete
adaptation of the Lua parser's code that compiles operator "." in a way that satisfies
this extra condition.

- Rafael Jannone

Fábio R. Cecin