Skip to content

Instantly share code, notes, and snippets.

@Be1zebub
Created January 14, 2024 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Be1zebub/b1f38d171f6f9c00dfd4b2af7dab3775 to your computer and use it in GitHub Desktop.
Save Be1zebub/b1f38d171f6f9c00dfd4b2af7dab3775 to your computer and use it in GitHub Desktop.
function debug.Trace()
local level = 1
Msg( "\nTrace:\n" )
while true do
local info = debug.getinfo( level, "Sln" )
if ( !info ) then break end
local indent = string.rep("\t", level)
if ( info.what ) == "C" then
Msg( string.format( "%s%i: %s - C function\n", indent, level, info.name ) )
else
Msg( string.format( "%s%i: %s - %s:%d\n", indent, level, info.name, info.short_src, info.currentline ) )
end
level = level + 1
end
Msg( "\n" )
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment