Closed markeel closed 3 months ago
Hhmmm... May be an oversight.
The souce is primarily used when loading separate modules for an easy way to track where functions come from.
It probably should be set also when running an AST. I'll take a look.
Found something strange. The test here:
https://github.com/rhaiscript/rhai/blob/main/tests/print.rs#L38
should test against setting source in the AST and getting it back in debug
statements.
EDIT: Ah, I see you're using call_fn
.
You can check out the new drop https://github.com/rhaiscript/rhai/pull/885
This should fix the issue.
Awesome, I'll check it out.
Closing this for now. Feel free to reopen if there are further issues.
I have started integrating rhai into my application and all is going well, but I wanted to catch debug statements, but the second parameter should be the source I specified after compiling the AST with "set_source()"
I've checked and a call to the AST after with ".source()" returns what I set, but the on_debug() call does not include the source parameter. It is always None.
This feels like a bug, but it's possible I'm not setting something up properly. The "Rhai Book" says the only thing necessary is to call set_source(), and because ".source()" is returning the expected value, I think I've done that.
Here is the registering of the on_debug statement
Here is where I create it.
Here is where I invoke it.
Here is the rhai script I am running:
What I get when I run it (it gets run twice in my test suite):