lua-users home
lua-l archive

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


>I have a system using templates. The application users will take an
>existing table, and clone it to create a copy which they then can tweak.

Instead of cloning a table A into a table B, why not create an empty table B
and set the __index metamethod of B to be A? With this setup, reading from B
reads from A, but writing to B writes to B, not to A. To handle tables inside A,
the __index metamethod would have to set the same scheme for these tables.
--lhf