diff options
Diffstat (limited to 'test/trace.lua')
-rw-r--r-- | test/trace.lua | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/test/trace.lua b/test/trace.lua deleted file mode 100644 index 5f32a8f9..00000000 --- a/test/trace.lua +++ /dev/null @@ -1,33 +0,0 @@ --- shows how to trace assigments to global variables - -T=newtag() -- tag for tracing - -function Ttrace(name) -- trace a global variable - local t={} - settag(t,T) - rawsetglobal(name,t) -end - -function Tsetglobal(name,old,new) - write("tracing: ",name," now is ",new,"\n") - old.value=new -end - -function Tgetglobal(x,value) -- get the actual value - return value.value -end - -settagmethod(T,"getglobal",Tgetglobal) -settagmethod(T,"setglobal",Tsetglobal) - --- now show it working - -Ttrace("a") -Ttrace("c") - -a=1 -b=2 -c=3 -a=10 -b=20 -c=30 |