mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-10 00:11:29 +00:00
initial commit. This is icculus version 5542b94cae02a6333845854bbbd1abe0a259f1a4
This commit is contained in:
commit
3096eaf5e2
2519 changed files with 816064 additions and 0 deletions
32
ExternalLibs/lua-5.1.4/test/trace-calls.lua
Normal file
32
ExternalLibs/lua-5.1.4/test/trace-calls.lua
Normal file
|
@ -0,0 +1,32 @@
|
|||
-- trace calls
|
||||
-- example: lua -ltrace-calls bisect.lua
|
||||
|
||||
local level=0
|
||||
|
||||
local 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
|
Loading…
Add table
Add a link
Reference in a new issue