- Joined
- Sep 12, 2020
- Messages
- 112
- Reaction score
- 26
Function parameters have been confirmed by the devs.
The way I imagine they would work is you put a bunch of scoped (Function-Local) variables in the Function chest, and they are set accordingly based on input to the Call Function.
I thought about how Function Return Values could be implemented and had some discussion about it and this is probably the best way of doing it:
Have a tag on the Function block specifying whether the Function is void or returns a value.
If the Function is set to void/no return:
Parameters in the return control block are ignored.
Every Call Function value counts as a parameter.
If the Function is set to return a value:
The first parameter in the Call Function (Which should be a variable) is NOT used as a parameter but rather the set variable.
The mentioned variable is set to whatever is inside the Return block (or 0 if none exists)
The call function menu would say whether the function has a return value or not when scrolling over the function.
Relevant Screenshots:
Hope this makes sense, there might be a better way to implement return values but this seems like the most sensible and convenient way of doing it.
The way I imagine they would work is you put a bunch of scoped (Function-Local) variables in the Function chest, and they are set accordingly based on input to the Call Function.
I thought about how Function Return Values could be implemented and had some discussion about it and this is probably the best way of doing it:
Have a tag on the Function block specifying whether the Function is void or returns a value.
If the Function is set to void/no return:
Parameters in the return control block are ignored.
Every Call Function value counts as a parameter.
If the Function is set to return a value:
The first parameter in the Call Function (Which should be a variable) is NOT used as a parameter but rather the set variable.
The mentioned variable is set to whatever is inside the Return block (or 0 if none exists)
The call function menu would say whether the function has a return value or not when scrolling over the function.
Relevant Screenshots:
Hope this makes sense, there might be a better way to implement return values but this seems like the most sensible and convenient way of doing it.