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

GDScript function parameter default value can be an expression #8465

Open
Efimero opened this issue Nov 13, 2023 · 0 comments
Open

GDScript function parameter default value can be an expression #8465

Efimero opened this issue Nov 13, 2023 · 0 comments
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:gdscript

Comments

@Efimero
Copy link

Efimero commented Nov 13, 2023

Your Godot version:
4.2 built from the repo on linux

Issue description:
In the GDScript reference basics page the functions section briefly mentions that function definitions can have typed and optional parameters. What it omits is it can also use an expression as the default value of a parameter. Specifically, another parameter can be referenced as the default value.
I am not sure if there are restrictions in the expressions used as a default value, but I have not seen this even mentioned elsewhere in the GDScript documentation.
As I don't know the breadth of this functionality, I wouldn't be comfortable documenting it, but someone definitely should, as it is really useful.

URL to the documentation page:
https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_basics.html#functions

@Efimero Efimero added the bug label Nov 13, 2023
@Piralein Piralein added the area:manual Issues and PRs related to the Manual/Tutorials section of the documentation label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:manual Issues and PRs related to the Manual/Tutorials section of the documentation enhancement topic:gdscript
Projects
None yet
Development

No branches or pull requests

3 participants