lua-users home
lua-l archive

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


> any sugestion?
> 
> the metatable have some features allowing the 
> catch of some events, but they dont seem be useful
> to solve my problem...
> 
> thank u..

Actually afaik metatables are the only way to do what you want. You can set a metatable with appropriate __index and __newindex evnets for the globals table, then each time a *new* variable gets read or written to your callback will be called with the needed arguments. That *new* part can be a problem though if you want your vars to hold values(in lua), they must be nil. A way to resolve this is to keep a proxy table, that is a table with all the vars(like the global one) where the vars actually have values. The the global table is uused to intercept the getting and setting of values and the proxy table is used to store them.
Hope that helps,
Dimitris