-
Notifications
You must be signed in to change notification settings - Fork 21
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
Calling function without an if #49
Comments
I see the same issue trying to call a command as shown here in the documentation (https://yarnspinner.dev/docs/unity/working-with-commands/). It doesn't do anything but yield a CommandResult. runner.js line 137 yields a CommandResult object instead of evaluating the function. There isn't a very good workaround due to the fact that the arguments are not evaluated for expressions. The CommandResult object should at least have an array of evaluated arguments, so that we could invoke the registered function. Instead we are handed the raw parameters which could include unevaluated expressions. The raw parameters are also given as a single parameter if using parenthesis to call the function. I think a reasonable solution would be to add a few properties to CommandResult, name, args and result. Why allow for custom function handler? Because there might be a need for synchronous functionality and calling a function is async. |
After looking at this closer, the parser and lexer would also have to be modified, because currently they only seem to be able to parse functions with arguments within a conditional. Also, nowhere in the documentation does it say that conditionals and assignments are to support function calls. So a function call can not be inside of an expression. This makes sense, because function calls do not require parenthesis encapsulating their arguments, making it ambiguous where the function call begins and ends. The spec would have to say, only function calls with arguments in parenthesis are allowed inside of an expression, and it doesn't say that anywhere. There is an exception though and that is the visited() function. |
Hello,
I've been having an issue trying to pass correct typed values to a function from Yarn.
I'm a bit confused about the syntax so here's an example of what I'm trying to do:
(This doesn't work)
My registered function AddPlayerStats doesn't get called. But if I use the function with and if or a set, it gets called successfully, like this:
(This works)
If I make this function a command instead of a function, it will only pass text values, and I don't want to parse the 50 as a int in my code, I want to get it typed just like the way I get it when using a Yarn function.
Is this a limitation?
Also another issue I'm having is, if I try to pass a variable to the function like this:
(This doesn't work)
I get this error:
Any advice?
Thanks in advance.
Juan
The text was updated successfully, but these errors were encountered: