lua-users home
lua-l archive

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

> assignments of the form 't.v' will cause __newindex to fire,
> if 'v' is not already present in t.  So the solution is a variation on
> the proxy trick;  t does not directly have your variables, but
> __newindex can redirect the lookup to some hidden table within t,
> _and_ fire a notification.

Thanks Steve,
Any Idea what the performance implications of having this hidden table will be. I imagine the memory overhead will be almost nothing because the hidden table contains all the memory and the real table is empty.

I think this solution will work fine for me. I will keep all values in this hidden table, as they can become indexed at any time, and then I will have an array that specifies which are indexed, which can change dynamically, and will control the notification firing in __newindex.

Any tips on how to do this cleanly would be appreciated, this is kinda tricky.