On Wed, 17 Apr 2013 22:42:38 +0200
Dirk Laurie <dirk.laurie@gmail.com> wrote:
2013/4/17 Steve Litt <slitt@troubleshooters.com>:
Is there any way to protect every last bit of _ENV? If so, I could
run the program and see every place where a global is being set.
Sure, see Programming in Lua by Roberto Ierusalimschy,
13.4.4 – Tracking Table Accesses.
http://www.lua.org/pil/13.4.4.html
Thanks Dirk,
That didn't work out quite as well as I'd hoped. It works just fine
with a global table named t, but when I change it to _G, it doesn't
work. Here's the program:
#!/usr/bin/lua
globalfname='Steve'
globallname='Litt'
-- keep a private access to original table
local _forbidden = _G
-- create proxy
_G = {}