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

Feature to pick up arguments passed into a compiled Catspeak function #52

Closed
JujuAdams opened this issue Jun 16, 2023 · 2 comments
Closed
Labels
enhancement New feature or request low priority Not important syntax Related to the syntax of the language

Comments

@JujuAdams
Copy link
Contributor

JujuAdams commented Jun 16, 2023

Couldn't find this one in the old v2 docs, but it'd be handy to be able to pass arguments into a Catspeak compiled functions and pick them up inside e.g.

func = Catspeak.compileGML(_asg);
func(x, y);
draw_text($param0, $param1. "Hello");

Or something similar. We can achieve a similar effect by calling .setSelf() on the function but direct argument passing would be easier to use in many situations.

@katsaii katsaii added the enhancement New feature or request label Jun 16, 2023
@katsaii
Copy link
Owner

katsaii commented Jun 16, 2023

I thought about exposing a way to do this, but I think you might just want to return a function and use named arguments on that instead:

funcMain = Catspeak.compileGML(_asg);
var func = funcMain();

func(x, y);
return fun(x, y) {
  draw_text(x, y, "Hello");
}

@katsaii katsaii added low priority Not important syntax Related to the syntax of the language labels Jun 16, 2023
@JujuAdams
Copy link
Contributor Author

JujuAdams commented Jun 17, 2023

Yeah ok! I can live with that.

Edit: When you get round to documentation it'd be good to cover this use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low priority Not important syntax Related to the syntax of the language
Projects
None yet
Development

No branches or pull requests

2 participants