lua-users home
lua-l archive

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


> In this case, I have overridden the global table, providing global variables
> with dynamic values.  This was working fine previously (using gettable) but
> I can't seem to get it working - any ideas?

Unlike __gettable, __index is only called when the table does not have
that element. If you want to call __index (and __newindex) on *every*
access to a table, you must make sure the table is empty. (For instance,
we can store the elements in another table, and the empty talbe works as
a proxy to the "real" table.)

-- Roberto