I want to get stack information the way i would with get_stack(), but I want it work to work even in the exported project. Is there a function that can already do that? If not, how can I create my own function that fetches this information for me? Is my request even possible?
EDIT: I want a solution that works for multi-threading and for other forms of asynchronous method calls
No, and the reason is very simple, when you export the game, this version is optimized to have max performance, but that comes at cost of less debug options as this options reduce the performance.
Is there a specific reason you need this information outside of the debugging build of the game?
Relying on the stack during runtime outside of debugging doesn’t sound ideal, unless you want to do Dependency Injection or something very specific.
I’m making a custom terminal that I want to use in my current project, but also in future projects, one of which does require injecting code at runtime.
In that case, I can think of two options. One is what you’re asking help with, to create your own. While this is possible, I’m afraid I don’t have enough experience with GDScript specifically to help out, but others might.
Another possible solution, if your project allows it, is to use the Mono version of Godot, as C# has a much more robust way of handling this, and you can write a relatively simple C# script to get the stack information, and you can call that function even with GDScript, so only that part of your code would use C#, the rest can stay as is.
This is just a small example and it might not be exactly what you’re looking for, but it’s a start: