lua-users home
lua-l archive

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


On 3/14/06, Noel Frankinet <> wrote:
> Hello,
> Is there a way to protect a variable like in tcl ("trace") ?
> That is, how to call c or lua code whenever a lua variable is accessed
> (read or write).

     If the variable is global you can use the __index and __newindex
metamethods, for each global variable belongs to a table (_G in the
most common case).