[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Read-Only Tables Patch
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 13 Nov 2006 20:49:33 -0200
> 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).