[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Read only tables.
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Wed, 17 Jun 2009 18:10:39 +0200
2009/6/17 <contact@imagine-programming.com>:
>> Van: Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>
>>> > setmetatable(__tMemory).__newindex=nil
>>>
>>> wouldn't that be:
>>>
>>> getmetatable(__tMemory).__newindex=nil
>>
>> oops, you're right, sorry.
>
> Thank you for your help, another thing learnen about metatables.
With that solution, once some keys are added to the table, reseting
the __newindex to the ronly function won't be enough to make it
read-only again. __newindex is only called if the key is not in the
table.