-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Update docs for GDScript 2.0 #3623
Conversation
8e7fc1a
to
f14688e
Compare
Looks good so far, will have a more in-depth look later. Should we mark this as draft until godotengine/godot#39093 is finished/merged? |
Sure, if you prefer. |
Now that godotengine/godot#40598 is merged we can also merge this. |
Include suggestions from Calinou Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
return local_var2 | ||
|
||
match param3: | ||
3: print("param3 is 3!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be indented like the one below.
I've added those sections in #3444. Can annotations provide a way to add groups and categories dynamically? Perhaps this can be adapted to "Adding script groups and categories dynamically via code". Maybe it deserves more detailed documentation on See example use case in godotengine/godot#10303 (comment). |
Annotations cannot do anything dynamically, they are only evaluated at compile-time. I guess we can leave this info here but should be worded as an advanced method for dynamic changes (I know right now it's the only way to do it, but annotations for this should come before Godot 4 is released). So if you want I can remove the deletion. Though I wish this could be approved and merged soon, as it already have conflicts again. |
I think that's fine to remove those sections for now, I was just curious how it plays with existing annotations system. As I said, it probably needs a better introduction on |
Hey @vnen it's looking good. I just fixed the remaining review comment. If you can fix the conflicts, I'll merge your PR. Alternatively, I can fix them for you if you'd like. |
To call a function in a *parent class* (i.e. one ``extend``-ed in your current | ||
class), prepend ``.`` to the function name:: | ||
To call a function in a *super class* (i.e. one ``extend``-ed in your current | ||
class), user the ``super`` keyword:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class), user the ``super`` keyword:: | |
class), use the ``super`` keyword:: |
|
||
# Named enum values | ||
|
||
# Editor will enumerate as THING_1, THING_2, ANOTHER_THING. | ||
enum NamedEnum {THING_1, THING_2, ANOTHER_THING = -1} | ||
export(NamedEnum) var x | ||
@export var x: NamedEnum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to work for me in the current master
branch (godotengine/godot@a6bb4f7).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I need to fix the export because it's missing some stuff still.
@vnen I'd like to merge this and other GDScript-related PRs, even if there'll be more changes in the coming weeks or months, to avoid merge conflicts down the road. Can I go ahead and rebase and merge? It's fine if there are some docs that don't work yet, the engine isn't even in alpha so the |
@NathanLovato I'll try to take sometime this week to fix the conflicts. Unless someone else is willing to do it sooner. |
I can do it. Unless you want to make changes, you can leave it to me. |
I had to open a new PR to fix the merge conflicts due to the rebase on master: #4247. Closing this one and merging the new PR |
GDScript syntax will change a bit after godotengine/godot#39093, so this is an update of the basics and export pages to fit the new way.
I removed the section for exporting arrays because it's still not supported, but I'll add it back once typing is re-added and there is a syntax for typed arrays.
I also removed the groups/categories sections because I plan to add those as annotations.