lua-users home
lua-l archive

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

I've noticed, it doesn't make it read only again.
Would I have to first set the metatable, and then only change
the index every time? from nil to ronly() ?

From: "Jerome Vuarand" <>
Sent: Wednesday, June 17, 2009 6:10 PM
To: "Lua list" <>
Subject: Re: Read only tables.

2009/6/17  <>:
Van: Luiz Henrique de Figueiredo <>
> setmetatable(__tMemory).__newindex=nil

wouldn't that be:


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

__________ NOD32 4162 (20090617) Informatie __________

Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.