lua-users home
lua-l archive

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


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.

-- 
Glenn Maynard