[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Read-Only Tables Patch
- From: Glenn Maynard <glenn@...>
- Date: Mon, 13 Nov 2006 18:05:39 -0500
On Mon, Nov 13, 2006 at 08:49:33PM -0200, Luiz Henrique de Figueiredo wrote:
> > My goal with this patch was to provide a mechanism for "publishing"
> > immutable data structures from C to Lua.
> In this case, a simpler solution is to use a single table with an __index
> metamethod only. Writing to fields in the table will not affect the C
> values. Absent fields will be read from C via the __index metamethod.
> This metamethod can also save the values in the table, so that it will
> act as a cache for C values (which may or may not be desirable).
This would allow modifying the cached values.