mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Add GDScript naming convention summary table
Co-Authored-By: Edwin <60202421+emarino135@users.noreply.github.com> Co-Authored-By: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
committed by
Max Hilbrunner
parent
032be9e338
commit
ce1be2c6e5
@@ -620,7 +620,29 @@ Naming conventions
|
||||
|
||||
These naming conventions follow the Godot Engine style. Breaking these will make
|
||||
your code clash with the built-in naming conventions, leading to inconsistent
|
||||
code.
|
||||
code. As a summary table:
|
||||
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Type | Convention | Example |
|
||||
+===============+================+====================================================+
|
||||
| File names | snake_case | ``yaml_parser.gd`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Class names | PascalCase | ``class_name YAMLParser`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Node names | PascalCase | ``Camera3D``, ``Player`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Functions | snake_case | ``func load_level():`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Variables | snake_case | ``var particle_effect`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Signals | snake_case | ``signal door_opened`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Constants | CONSTANT_CASE | ``const MAX_SPEED = 200`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Enum names | PascalCase | ``enum Element`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
| Enum members | CONSTANT_CASE | ``{EARTH, WATER, AIR, FIRE}`` |
|
||||
+---------------+----------------+----------------------------------------------------+
|
||||
|
||||
File names
|
||||
~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user