[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Query about gettable tag methods.
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 10 May 2001 11:19:07 -0300 (EST)
>I would like data access to occur when using the '.' syntax and a function
>access to occur when using the ':' syntax .
In principle, this is not possible because userdata:Add() is simply sugar for
userdata.Add(userdata).
As you mention, the opcode for userdata.Add is GETDOTTED while the opcode for
userdata:Add() is PUSHSELF (always followed by a CALL), so the parser knows all
about this, but unfortunately there is no language-level way to make this
distinction.
A similar problem occurs when you try to trap calls such as f() where f
is not defined. You may set a "getglobal" tag method but it is called *before*
the call is attempted.
One possible solution for both problem is to have the "gettable" or "getglobal"
tag method return a table for which a "function" tag method is defined.
--lhf