lua-users home
lua-l archive

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

Maybe i'm wrong but...

If you add __newindex, and get it to store stuff not in the actual _G
but in a hidden _G table, then you can always track access to that
variable. Of course, you would need to make __index also use that hidden
_G, but that can just be a delegator.

I can't think of the implementation details right now, but for me, that
sounds about usable.

// David Morris-Oliveros
// Camera & Lua Coder

Ron Bessems wrote:
Question for you all, we need to get a notification every time
any global variable is modified in lua 5.0.

I've looked at chapter 13.4 (table access meta-methods) but it seems
that those access methods cannot track if a variable already exists,
so then a proxy table is used, but then we loose the ability to
iterate over the table.

Is there some way to go into the Lua Source code to do this? Anything
that allows us to hook global variable access notifications? We are
very much locked into Lua 5.0 so sadly can't upgrade to 5.1. I am a
C/C++ coder so I can work on the lua code if needed, a few pointers
where to start would be great.