-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes an unnecessary and potentially confusing comparison of annotations to keywords and generally improves wording in the GDScript Basics tutorial. A new page to the Contributing section has been added for scripting development guidelines. This new page hosts suggestions on when annotations should be implemented in GDScript.
- Loading branch information
Showing
3 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
contributing/development/core_and_modules/scripting_development.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.. _doc_scripting_development: | ||
|
||
Scripting development | ||
===================== | ||
|
||
GDScript | ||
-------- | ||
|
||
Annotation guidelines | ||
~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
.. | ||
This description intentionally avoids mention of implementation and | ||
compilation details because these are often inconsistent between annotations | ||
Create annotations for modifiers that act on the script or its code. | ||
Addionally, create annotations for behaviour that is specific to the Godot | ||
engine and editor; if the primary purpose is to affect the way that the engine | ||
or editor treats or interacts with the script, implement the token as an | ||
annotation. | ||
|
||
Do not create annotations for general programming language features. | ||
|
||
:: | ||
|
||
# Affects how the editor treats this script. | ||
@icon("res://path/to/class/icon.svg") | ||
# Affects how the engine interacts this script. | ||
@onready var character_name = $Label | ||
|
||
# static is a general programming language feature. | ||
static var num_players = 2 | ||
|
||
For historical reasons, some existing annotations and keywords do not strictly | ||
follow these guidelines. Choosing between implementing a feature as an | ||
annotation or as a language keyword is a nuanced decision that should be made | ||
through discussion with other GDScript developers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters