lua-users home
lua-l archive

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

> 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).