PATH:
usr
/
share
/
doc
/
lua50
/
examples
-- trace calls -- example: lua -ltrace-calls.lua bisect.lua local level=0 function hook(event) local t=debug.getinfo(3) io.write(level," >>> ",string.rep(" ",level)) if t~=nil and t.currentline>=0 then io.write(t.short_src,":",t.currentline," ") end t=debug.getinfo(2) if event=="call" then level=level+1 else level=level-1 if level<0 then level=0 end end if t.what=="main" then if event=="call" then io.write("begin ",t.short_src) else io.write("end ",t.short_src) end elseif t.what=="Lua" then -- table.foreach(t,print) io.write(event," ",t.name or "(Lua)"," <",t.linedefined,":",t.short_src,">") else io.write(event," ",t.name or "(C)"," [",t.what,"] ") end io.write("\n") end debug.sethook(hook,"cr") level=0
[-] fib.lua
[edit]
[-] hello.lua
[edit]
[-] trace-calls.lua
[edit]
[-] factorial.lua
[edit]
[-] cf.lua
[edit]
[-] bisect.lua
[edit]
[-] globals.lua
[edit]
[-] undefined.lua
[edit]
[-] README
[edit]
[-] trace-globals.lua
[edit]
[-] readonly.lua
[edit]
[-] printf.lua
[edit]
[-] sieve.lua
[edit]
[-] table.lua
[edit]
[+]
..
[-] sort.lua
[edit]
[-] luac.lua
[edit]
[-] env.lua
[edit]
[-] xd.lua
[edit]
[-] life.lua
[edit]
[-] echo.lua
[edit]
[-] fibfor.lua
[edit]