lua-users home
lua-l archive

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


Take a look at operator ":", it does exactly what you want operator "->" to do.

Just use instance:method( arg1, arg2 ) instead of instance->method( arg1, arg2 ).

Hope it helps,
Thiago Bastos

------------ Reply Separator  ------------

On 26/10/2002 at 01:01 Fabio Reis Cecin wrote:

>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 "->")
>
>Example:
>
>   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
>
>
>--
>[]'s
>Fábio R. Cecin
>frcecin@terra.com.br

----------------------------------------------------