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

Support for Function arguments #23

Open
WilliamRagstad opened this issue Jun 9, 2020 · 2 comments
Open

Support for Function arguments #23

WilliamRagstad opened this issue Jun 9, 2020 · 2 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@WilliamRagstad
Copy link

There is a poly-fill trick for supporting arguments to functions using the new /data get storage [name] [path].
Format example:

mcscriptfunctions
|___ [function name]
        |___ [meta data]
        |___ [arguments]
               |___ [0]
               |___ [1]
               |___ ...
               |___ [N]

This will allow for real-time function calls if you create a macro that generates commands similar to the following code: (simulating using C#)

void callToFunction(string name, object[] args) {
   string r = "/data modify storage MCScriptFunctions " + name + ".arguments set value [";
   for(int i = 0; i < args.length; i++) r += args[i];
   r += "]\n"
   r += "/function " + name;
}

This could probably be optimized in many ways regarding to recursion etc (can be solved by storing arguments in temp variables), but this is the overall picture.

@Heath123
Copy link

Heath123 commented Jun 9, 2020

Sadly mcscript isn't really maintained or updated any more...

@Stevertus
Copy link
Owner

This is a great idea, but as @Heath123 mentioned I am not adding new features to mcscript anymore, because the work required to rearrange everything is too much. I could see this in my modular approach objD though.

@Stevertus Stevertus added enhancement New feature or request wontfix This will not be worked on labels Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants