[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Detecting read or write access in __index metamethod
- From: Javier Guerra Giraldez <javier@...>
- Date: Wed, 15 Dec 2010 10:37:52 -0500
On Wed, Dec 15, 2010 at 10:33 AM, Marc Balmer <marc@msys.ch> wrote:
> Am 15.12.10 16:30, schrieb HyperHacker:
>> On Wed, Dec 15, 2010 at 08:28, Marc Balmer <marc@msys.ch> wrote:
>>> a.b.c = 42
>>>
>>> and
>>>
>>> local answer = a.b.c
>>
>> The first triggers __newindex, if the value isn't already set.
>
> Yes, but only for tables. I am "hiding" a hierarchical data container
> behind this syntax, so my data is actually "userdata".
for userdata too, but i guess in your case you mean your object is
'a'. if so, no, there's no way to separate them, since the only
operation done to 'a' is to get the 'b' object.
what you would have to do is to handle this at the 'c' object, which
is the one written to
--
Javier