8000 Incomplete stack trace when requiring a module that does not return a valid value · Issue #131 · luau-lang/lute · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Incomplete stack trace when requiring a module that does not return a valid value #131

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

Closed
DarkenedRing opened this issue Mar 31, 2025 · 1 comment · Fixed by #238
Closed
Assignees
Labels
bug Something isn't working runtime Work in the C++ runtime portion of the code
Milestone

Comments

@DarkenedRing
Copy link

one.luau (main file)

require("./two")

two.luau

require("./three")
return {}

three.luau

return nil -- only tables and functions are allowed: https://github.com/aatxe/lute/blob/dfe09d37e45687f4236aaae404809ff2b9abb97f/runtime/src/require.cpp#L176
$ lute one.luau 
module must return a table or function
stacktrace:
[C] function require
one.luau:1

^ two.luau:1 should be included in the stack trace

@aatxe aatxe added bug Something isn't working runtime Work in the C++ runtime portion of the code labels Mar 31, 2025
@aatxe
Copy link
Collaborator
aatxe commented Mar 31, 2025

cc @vrn-sn

I imagine this is something we can fix with the new require apis getting exposed in Luau.

@aatxe aatxe added this to the 0.1.0 Release milestone Apr 23, 2025
aatxe pushed a commit that referenced this issue Apr 30, 2025
Required modules run in their own threads in Lute, and there isn't an
easy way to automatically "inherit" a stack trace across a thread
boundary. To make it more user-friendly to debug where an issue is
coming from in required modules, each module thread now stores its stack
trace in its error message in the case of an error, appended to the
actual error message.

---

To demonstrate, I have five Luau files that require each other in a
chain: `a.luau`, `b.luau`, `c.luau`, `d.luau`, and `e.luau`. At the end
of the chain, `e.luau` attempts to (illegally) yield.

Prior to this change, Lute outputted this:
```
module can not yield
stacktrace:
[C] function require
a:1
```

This is what Lute outputs now:
```
module can not yield
[C] function yield
./e:1
[C] function require
./d:1
[C] function require
./c:1
[C] function require
./b:1

stacktrace:
[C] function require
a:1
```

Fixes #131.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working runtime Work in the C++ runtime portion of the code
Development

Successfully merging a pull request may close this issue.

3 participants
0