Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STP.stacktrace not strictly compatible to debug.traceback #11

Open
devurandom opened this issue Nov 12, 2015 · 2 comments
Open

STP.stacktrace not strictly compatible to debug.traceback #11

devurandom opened this issue Nov 12, 2015 · 2 comments

Comments

@devurandom
Copy link

STP.stacktrace is not strictly compatible to debug.traceback: It returns two values, instead of one. This creates problems in conjunction with varargs functions and those created through the Lua C API (which will happily consume the additional argument, creating an unexpected stack layout).

Is this something you want to fix?

--- a/src/StackTracePlus.lua
+++ b/src/StackTracePlus.lua
@@ -391,7 +392,7 @@ Stack Traceback
                info = dumper.getinfo(level, "nSlf")
        end

-       return dumper:concat_lines(), original_error
+       return dumper:concat_lines()
 end

 --
@ignacio
Copy link
Owner

ignacio commented Nov 12, 2015

I'm not sure. Can't you just wrap it in a function to adjust the number of return values? Like,

debug.traceback = function(...) return (STP.stacktrace(...)) end

@SoniEx2
Copy link

SoniEx2 commented Nov 13, 2017

As a compromise, provide STP.traceback (with name matching debug.traceback) that does exactly that?

Are there any cases where debug.traceback returns 0 or 2 values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants