lua-users home
lua-l archive

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


> I could use a proxy table and catch every access via __newindex, but I think
> the problem with that is the main table then doesn't behave right for things
> like pairs, because it's empty.

You can redefine pairs to work for proxy tables, say by honoring a __next
metamethod. See http://lua-users.org/wiki/GeneralizedPairsAndIpairs for a
C implementation, but it's easy to do it in Lua as well. --lhf