{"id":13896719,"url":"https://github.com/ignacio/StackTracePlus","last_synced_at":"2025-07-17T13:30:57.501Z","repository":{"id":1162271,"uuid":"1051851","full_name":"ignacio/StackTracePlus","owner":"ignacio","description":"StackTracePlus provides enhanced stack traces for Lua.","archived":false,"fork":false,"pushed_at":"2023-07-24T00:50:55.000Z","size":39,"stargazers_count":198,"open_issues_count":11,"forks_count":27,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-08T11:51:26.285Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ignacio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2010-11-04T18:13:09.000Z","updated_at":"2025-03-22T16:26:51.000Z","dependencies_parsed_at":"2024-01-08T20:19:18.249Z","dependency_job_id":null,"html_url":"https://github.com/ignacio/StackTracePlus","commit_stats":{"total_commits":43,"total_committers":6,"mean_commits":7.166666666666667,"dds":0.4651162790697675,"last_synced_commit":"6c557a2638ceb72209d7e8c95070609725fa8dbe"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ignacio/StackTracePlus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignacio%2FStackTracePlus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignacio%2FStackTracePlus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignacio%2FStackTracePlus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignacio%2FStackTracePlus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignacio","download_url":"https://codeload.github.com/ignacio/StackTracePlus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignacio%2FStackTracePlus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265611086,"owners_count":23797809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T18:03:06.618Z","updated_at":"2025-07-17T13:30:57.255Z","avatar_url":"https://github.com/ignacio.png","language":"Lua","funding_links":[],"categories":["Lua","资源","Resources"],"sub_categories":["Debugging and Profiling","Debugging"],"readme":"# StackTracePlus #\r\n\r\n[![Build Status](https://travis-ci.org/ignacio/StackTracePlus.png?branch=master)](https://travis-ci.org/ignacio/StackTracePlus)\r\n[![Coverage Status](https://coveralls.io/repos/github/ignacio/StackTracePlus/badge.svg?branch=master)](https://coveralls.io/github/ignacio/StackTracePlus?branch=master)\r\n\r\nStackTracePlus provides enhanced stack traces for [Lua 5.1, Lua 5.2, Lua 5.3][1], [LuaJIT][2] and [OpenResty][4].\r\n\r\nStackTracePlus can be used as a replacement for debug.traceback. It gives detailed information about locals, tries to guess\r\nfunction names when they're not available, etc, so, instead of\r\n\r\n    lua5.1.exe: D:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:10: attempt to concatenate a nil value\r\n    stack traceback:\r\n    \tD:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:10: in function \u003cD:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:7\u003e\r\n    \t(tail call): ?\r\n    \tD:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:15: in main chunk\r\n    \t[C]: ?\r\n\t\t\r\nyou'll get\r\n\r\n    lua5.1.exe: D:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:10: attempt to concatenate a nil value\r\n    Stack Traceback\r\n    ===============\r\n    (2)  C function 'function: 00A8F418'\r\n    (3) Lua function 'g' at file 'D:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua:10' (best guess)\r\n    \tLocal variables:\r\n    \t fun = table module\r\n    \t str = string: \"hey\"\r\n    \t tb = table: 027DCBE0  {dummy:1, blah:true, foo:bar}\r\n    \t (*temporary) = nil\r\n    \t (*temporary) = string: \"text\"\r\n    \t (*temporary) = string: \"attempt to concatenate a nil value\"\r\n    (4) tail call\r\n    (5) main chunk of file 'D:\\trunk_git\\sources\\stacktraceplus\\test\\test.lua' at line 15\r\n    (6)  C function 'function: 002CA480'\r\n\r\n## Usage #\r\n\r\nStackTracePlus can be used as a replacement for `debug.traceback`, as an `xpcall` error handler or even from C code. Note that\r\nonly the Lua 5.1 interpreter and OpenResty allows the traceback function to be replaced \"on the fly\". Interpreters for LuaJIT, Lua 5.2 and 5.3 always calls luaL_traceback internally so there is no easy way to override that.\r\n\r\n```lua\r\nlocal STP = require \"StackTracePlus\"\r\n\r\ndebug.traceback = STP.stacktrace\r\nfunction test()\r\n\tlocal s = \"this is a string\"\r\n\tlocal n = 42\r\n\tlocal t = { foo = \"bar\" }\r\n\tlocal co = coroutine\r\n\tlocal cr = coroutine.create\r\n\t\r\n\terror(\"an error\")\r\nend\r\ntest()\r\n```\r\n\r\nThat script will output (only with Lua 5.1):\r\n\r\n    lua5.1: example.lua:11: an error\r\n    Stack Traceback\r\n    ===============\r\n    (2)  C function 'function: 006B5758'\r\n    (3) global C function 'error'\r\n    (4) Lua global 'test' at file 'example.lua:11'\r\n            Local variables:\r\n             s = string: \"this is a string\"\r\n             n = number: 42\r\n             t = table: 006E5220  {foo:bar}\r\n             co = coroutine table\r\n             cr = C function: 003C7080\r\n    (5) main chunk of file 'example.lua' at line 14\r\n    (6)  C function 'function: 00637B30'\r\n\r\n**StackTracePlus** is aware of the usual Lua libraries, like *coroutine*, *table*, *string*, *io*, etc and functions like\r\n*print*, *pcall*, *assert*, and so on.\r\n\r\nYou can also make STP aware of your own tables and functions by calling *add_known_function* and *add_known_table*.\r\n\r\n```lua\r\nlocal STP = require \"StackTracePlus\"\r\n\r\ndebug.traceback = STP.stacktrace\r\nlocal my_table = {\r\n\tf = function() end\r\n}\r\nfunction my_function()\r\nend\r\n\r\nfunction test(data, func)\r\n\tlocal s = \"this is a string\"\r\n\t\r\n\terror(\"an error\")\r\nend\r\n\r\nSTP.add_known_table(my_table, \"A description for my_table\")\r\nSTP.add_known_function(my_function, \"A description for my_function\")\r\n\r\ntest( my_table, my_function )\r\n```\r\n\r\nWill output:\r\n\r\n    lua5.1: ..\\test\\example2.lua:13: an error\r\n    Stack Traceback\r\n    ===============\r\n    (2)  C function 'function: 0073AAA8'\r\n    (3) global C function 'error'\r\n    (4) Lua global 'test' at file '..\\test\\example2.lua:13'\r\n            Local variables:\r\n             data = A description for my_table\r\n             func = Lua function 'A description for my_function' (defined at line 7 of chunk ..\\test\\example2.lua)\r\n             s = string: \"this is a string\"\r\n    (5) main chunk of file '..\\test\\example2.lua' at line 19\r\n    (6)  C function 'function: 00317B30'\r\n\r\n\r\n## Installation #\r\nThe easiest way to install is with [LuaRocks][3].\r\n\r\n  - luarocks install stacktraceplus\r\n\r\nIf you don't want to use LuaRocks, just copy StackTracePlus.lua to Lua's path.\r\n\r\n## License #\r\n**StackTracePlus** is available under the MIT license.\r\n\r\n[1]: http://www.lua.org/\r\n[2]: http://luajit.org/\r\n[3]: https://luarocks.org/\r\n[4]: https://openresty.org/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignacio%2FStackTracePlus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignacio%2FStackTracePlus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignacio%2FStackTracePlus/lists"}