2 -- example: lua -ltrace-calls bisect.lua
6 local function hook(event)
7 local t=debug.getinfo(3)
8 io.write(level," >>> ",string.rep(" ",level))
9 if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end
14 level=level-1 if level<0 then level=0 end
16 if t.what=="main" then
18 io.write("begin ",t.short_src)
20 io.write("end ",t.short_src)
22 elseif t.what=="Lua" then
23 -- table.foreach(t,print)
24 io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">")
26 io.write(event," ",t.name or "(C)"," [",t.what,"] ")
31 debug.sethook(hook,"cr")