diff options
author | Lua Team <team@lua.org> | 2000-11-06 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2000-11-06 12:00:00 +0000 |
commit | 8cb71cb5548e3138e5d4e4744f52c79d9fafb116 (patch) | |
tree | 25859eb162c67eafc46866e0ec3a9a7ebf93157a /test/trace-calls.lua | |
parent | b7610da5fed99f59ac73ae452da8839a0f2c1bda (diff) | |
download | lua-github-4.0.tar.gz |
Lua 4.04.0
Diffstat (limited to 'test/trace-calls.lua')
-rw-r--r-- | test/trace-calls.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/trace-calls.lua b/test/trace-calls.lua new file mode 100644 index 00000000..a073cc20 --- /dev/null +++ b/test/trace-calls.lua @@ -0,0 +1,23 @@ +-- trace calls +-- example: lua trace-calls.lua hello.lua bisect.lua + +function callhook(func) + local t=getinfo(2) + write(">>> ") +--foreach(t,print) + if t.what=="main" then + if func=="call" then + write("begin ",t.source) + else + write("end ",t.source) + end + elseif t.what=="Lua" then + write(func," ",t.name," <",t.linedefined,":",t.source,">") + else + write(func," ",t.name," [",t.what,"] ") + end + if t.currentline>=0 then write(":",t.currentline) end + write("\n") +end + +setcallhook(callhook) |