1 -- trace assigments to global variables
4 -- a tostring that quotes strings. note the use of the original tostring.
5 local _tostring=tostring
6 local tostring=function(a)
7 if type(a)=="string" then
8 return string.format("%q",a)
14 local log=function (name,old,new)
15 local t=debug.getinfo(3,"Sl")
16 local line=t.currentline
18 if line>=0 then io.write(":",line) end
19 io.write(": ",name," is now ",tostring(new)," (was ",tostring(old),")","\n")
23 local set=function (t,name,value)
24 log(name,g[name],value)
27 setmetatable(getfenv(),{__index=g,__newindex=set})