Files
godot-docs-l10n/sphinx/templates/getting_started/scripting/gdscript/gdscript_basics.pot
2019-12-03 10:52:13 +01:00

1518 lines
64 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2014-2019, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0)
# This file is distributed under the same license as the Godot Engine package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Godot Engine latest\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-12-03 10:51+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:4
msgid "GDScript basics"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:7
msgid "Introduction"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:9
msgid "*GDScript* is a high-level, dynamically typed programming language used to create content. It uses a syntax similar to `Python <https://en.wikipedia.org/wiki/Python_%28programming_language%29>`_ (blocks are indent-based and many keywords are similar). Its goal is to be optimized for and tightly integrated with Godot Engine, allowing great flexibility for content creation and integration."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:17
msgid "History"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:19
msgid "In the early days, the engine used the `Lua <https://www.lua.org>`__ scripting language. Lua is fast, but creating bindings to an object oriented system (by using fallbacks) was complex and slow and took an enormous amount of code. After some experiments with `Python <https://www.python.org>`__, it also proved difficult to embed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:25
msgid "The last third party scripting language that was used for shipped games was `Squirrel <http://squirrel-lang.org>`__, but it was dropped as well. At that point, it became evident that a custom scripting language could more optimally make use of Godot's particular architecture:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:30
msgid "Godot embeds scripts in nodes. Most languages are not designed with this in mind."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:32
msgid "Godot uses several built-in data types for 2D and 3D math. Script languages do not provide this, and binding them is inefficient."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:34
msgid "Godot uses threads heavily for lifting and initializing data from the net or disk. Script interpreters for common languages are not friendly to this."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:37
msgid "Godot already has a memory management model for resources, most script languages provide their own, which results in duplicate effort and bugs."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:40
msgid "Binding code is always messy and results in several failure points, unexpected bugs and generally low maintainability."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:43
msgid "The result of these considerations is *GDScript*. The language and interpreter for GDScript ended up being smaller than the binding code itself for Lua and Squirrel, while having equal functionality. With time, having a built-in language has proven to be a huge advantage."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:49
msgid "Example of GDScript"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:51
msgid "Some people can learn better by taking a look at the syntax, so here's a simple example of how GDScript looks."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:129
msgid "If you have previous experience with statically typed languages such as C, C++, or C# but never used a dynamically typed one before, it is advised you read this tutorial: :ref:`doc_gdscript_more_efficiently`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:134
msgid "Language"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:136
msgid "In the following, an overview is given to GDScript. Details, such as which methods are available to arrays or other objects, should be looked up in the linked class descriptions."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:141
msgid "Identifiers"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:143
msgid "Any string that restricts itself to alphabetic characters (``a`` to ``z`` and ``A`` to ``Z``), digits (``0`` to ``9``) and ``_`` qualifies as an identifier. Additionally, identifiers must not begin with a digit. Identifiers are case-sensitive (``foo`` is different from ``FOO``)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:149
msgid "Keywords"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:151
msgid "The following is the list of keywords supported by the language. Since keywords are reserved words (tokens), they can't be used as identifiers. Operators (like ``in``, ``not``, ``and`` or ``or``) and names of built-in types as listed in the following sections are also reserved."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:156
msgid "Keywords are defined in the `GDScript tokenizer <https://github.com/godotengine/godot/blob/master/modules/gdscript/gdscript_tokenizer.cpp>`_ in case you want to take a look under the hood."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:160
msgid "Keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:160
msgid "Description"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:162
msgid "if"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:162
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:164
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:166
msgid "See `if/else/elif`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:164
msgid "elif"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:166
msgid "else"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:168
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:802
msgid "for"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:168
msgid "See for_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:170
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:791
msgid "while"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:170
msgid "See while_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:172
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:837
msgid "match"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:172
msgid "See match_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:174
msgid "break"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:174
msgid "Exits the execution of the current ``for`` or ``while`` loop."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:176
msgid "continue"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:176
msgid "Immediately skips to the next iteration of the ``for`` or ``while`` loop."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:178
msgid "pass"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:178
msgid "Used where a statement is required syntactically but execution of code is undesired, e.g. in empty functions."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:180
msgid "return"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:180
msgid "Returns a value from a function."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:182
msgid "class"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:182
msgid "Defines a class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:184
msgid "extends"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:184
msgid "Defines what class to extend with the current class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:186
msgid "is"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:186
msgid "Tests whether a variable extends a given class, or is of a given built-in type."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:188
msgid "as"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:188
msgid "Cast the value to a given type if possible."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:190
msgid "self"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:190
msgid "Refers to current class instance."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:192
msgid "tool"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:192
msgid "Executes the script in the editor."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:194
msgid "signal"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:194
msgid "Defines a signal."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:196
msgid "func"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:196
msgid "Defines a function."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:198
msgid "static"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:198
msgid "Defines a static function. Static member variables are not allowed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:200
msgid "const"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:200
msgid "Defines a constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:202
msgid "enum"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:202
msgid "Defines an enum."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:204
msgid "var"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:204
msgid "Defines a variable."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:206
msgid "onready"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:206
msgid "Initializes a variable once the Node the script is attached to and its children are part of the scene tree."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:208
msgid "export"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:208
msgid "Saves a variable along with the resource it's attached to and makes it visible and modifiable in the editor."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:210
msgid "setget"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:210
msgid "Defines setter and getter functions for a variable."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:212
msgid "breakpoint"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:212
msgid "Editor helper for debugger breakpoints."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:214
msgid "preload"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:214
msgid "Preloads a class or variable. See `Classes as resources`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:216
msgid "yield"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:216
msgid "Coroutine support. See `Coroutines with yield`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:218
msgid "assert"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:218
msgid "Asserts a condition, logs error on failure. Ignored in non-debug builds. See `Assert keyword`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:220
msgid "remote"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:220
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:222
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:224
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:226
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:228
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:230
msgid "Networking RPC annotation. See :ref:`high-level multiplayer docs <doc_high_level_multiplayer>`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:222
msgid "master"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:224
msgid "puppet"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:226
msgid "remotesync"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:228
msgid "mastersync"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:230
msgid "puppetsync"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:232
msgid "PI"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:232
msgid "PI constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:234
msgid "TAU"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:234
msgid "TAU constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:236
msgid "INF"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:236
msgid "Infinity constant. Used for comparisons."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:238
msgid "NAN"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:238
msgid "NAN (not a number) constant. Used for comparisons."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:242
msgid "Operators"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:244
msgid "The following is the list of supported operators and their precedence."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:247
msgid "**Operator**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:247
msgid "**Description**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:249
msgid "``x[index]``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:249
msgid "Subscription (highest priority)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:251
msgid "``x.attribute``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:251
msgid "Attribute reference"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:253
msgid "``is``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:253
msgid "Instance type checker"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:255
msgid "``~``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:255
msgid "Bitwise NOT"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:257
msgid "``-x``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:257
msgid "Negative / Unary negation"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:259
msgid "``*`` ``/`` ``%``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:259
msgid "Multiplication / Division / Remainder"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:261
msgid "These operators have the same behavior as C++. Integer division is truncated rather than returning a fractional number, and the % operator is only available for ints (\"fmod\" for floats)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:267
msgid "``+``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:267
msgid "Addition / Concatenation of arrays"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:269
msgid "``-``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:269
msgid "Subtraction"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:271
msgid "``<<`` ``>>``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:271
msgid "Bit shifting"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:273
msgid "``&``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:273
msgid "Bitwise AND"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:275
msgid "``^``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:275
msgid "Bitwise XOR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:277
msgid "``|``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:277
msgid "Bitwise OR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:279
msgid "``<`` ``>`` ``==`` ``!=`` ``>=`` ``<=``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:279
msgid "Comparisons"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:281
msgid "``in``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:281
msgid "Content test"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:283
msgid "``!`` ``not``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:283
msgid "Boolean NOT"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:285
msgid "``and`` ``&&``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:285
msgid "Boolean AND"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:287
msgid "``or`` ``||``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:287
msgid "Boolean OR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:289
msgid "``if x else``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:289
msgid "Ternary if/else"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:291
msgid "``=`` ``+=`` ``-=`` ``*=`` ``/=`` ``%=`` ``&=`` ``|=``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:291
msgid "Assignment (lowest priority)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:295
msgid "Literals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:298
msgid "**Literal**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:298
msgid "**Type**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:300
msgid "``45``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:300
msgid "Base 10 integer"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:302
msgid "``0x8F51``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:302
msgid "Base 16 (hexadecimal) integer"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:304
msgid "``0b101010``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:304
msgid "Base 2 (binary) integer"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:306
msgid "``3.14``, ``58.1e-10``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:306
msgid "Floating-point number (real)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:308
msgid "``\"Hello\"``, ``\"Hi\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:308
msgid "Strings"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:310
msgid "``\"\"\"Hello\"\"\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:310
msgid "Multiline string"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:312
msgid "``@\"Node/Label\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:312
msgid ":ref:`class_NodePath` or StringName"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:314
msgid "``$NodePath``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:314
msgid "Shorthand for ``get_node(\"NodePath\")``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:318
msgid "Comments"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:320
msgid "Anything from a ``#`` to the end of the line is ignored and is considered a comment."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:330
msgid "Built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:332
msgid "Built-in types are stack-allocated. They are passed as values. This means a copy is created on each assignment or when passing them as arguments to functions. The only exceptions are ``Array``\\ s and ``Dictionaries``, which are passed by reference so they are shared. (Pooled arrays such as ``PoolByteArray`` are still passed as values.)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:339
msgid "Basic built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:341
msgid "A variable in GDScript can be assigned to several built-in types."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:344
msgid "null"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:346
msgid "``null`` is an empty data type that contains no information and can not be assigned any other value."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:350
msgid "bool"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:352
msgid "Short for \"boolean\", it can only contain ``true`` or ``false``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:355
msgid "int"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:357
msgid "Short for \"integer\", it stores whole numbers (positive and negative). It is stored as a 64-bit value, equivalent to \"int64_t\" in C++."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:361
msgid "float"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:363
msgid "Stores real numbers, including decimals, using floating-point values. It is stored as a 64-bit value, equivalent to \"double\" in C++. Note: Currently, data structures such as Vector2, Vector3, and PoolRealArray store 32-bit single-precision \"float\" values."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:369
msgid ":ref:`String <class_String>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:371
msgid "A sequence of characters in `Unicode format <https://en.wikipedia.org/wiki/Unicode>`_. Strings can contain `standard C escape sequences <https://en.wikipedia.org/wiki/Escape_sequences_in_C>`_. GDScript also supports :ref:`doc_gdscript_printf`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:377
msgid "Vector built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:380
msgid ":ref:`Vector2 <class_Vector2>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:382
msgid "2D vector type containing ``x`` and ``y`` fields. Can also be accessed as array."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:386
msgid ":ref:`Rect2 <class_Rect2>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:388
msgid "2D Rectangle type containing two vectors fields: ``position`` and ``size``. Also contains an ``end`` field which is ``position + size``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:392
msgid ":ref:`Vector3 <class_Vector3>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:394
msgid "3D vector type containing ``x``, ``y`` and ``z`` fields. This can also be accessed as an array."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:398
msgid ":ref:`Transform2D <class_Transform2D>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:400
msgid "3×2 matrix used for 2D transforms."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:403
msgid ":ref:`Plane <class_Plane>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:405
msgid "3D Plane type in normalized form that contains a ``normal`` vector field and a ``d`` scalar distance."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:409
msgid ":ref:`Quat <class_Quat>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:411
msgid "Quaternion is a datatype used for representing a 3D rotation. It's useful for interpolating rotations."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:415
msgid ":ref:`AABB <class_AABB>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:417
msgid "Axis-aligned bounding box (or 3D box) contains 2 vectors fields: ``position`` and ``size``. Also contains an ``end`` field which is ``position + size``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:422
msgid ":ref:`Basis <class_Basis>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:424
msgid "3x3 matrix used for 3D rotation and scale. It contains 3 vector fields (``x``, ``y`` and ``z``) and can also be accessed as an array of 3D vectors."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:429
msgid ":ref:`Transform <class_Transform>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:431
msgid "3D Transform contains a Basis field ``basis`` and a Vector3 field ``origin``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:435
msgid "Engine built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:438
msgid ":ref:`Color <class_Color>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:440
msgid "Color data type contains ``r``, ``g``, ``b``, and ``a`` fields. It can also be accessed as ``h``, ``s``, and ``v`` for hue/saturation/value."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:444
msgid ":ref:`NodePath <class_NodePath>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:446
msgid "Compiled path to a node used mainly in the scene system. It can be easily assigned to, and from, a String."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:450
msgid ":ref:`RID <class_RID>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:452
msgid "Resource ID (RID). Servers use generic RIDs to reference opaque data."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:455
msgid ":ref:`Object <class_Object>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:457
msgid "Base class for anything that is not a built-in type."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:460
msgid "Container built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:463
msgid ":ref:`Array <class_Array>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:465
msgid "Generic sequence of arbitrary object types, including other arrays or dictionaries (see below). The array can resize dynamically. Arrays are indexed starting from index ``0``. Negative indices count from the end."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:479
msgid "GDScript arrays are allocated linearly in memory for speed. Large arrays (more than tens of thousands of elements) may however cause memory fragmentation. If this is a concern, special types of arrays are available. These only accept a single data type. They avoid memory fragmentation and use less memory, but are atomic and tend to run slower than generic arrays. They are therefore only recommended to use for large data sets:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:486
msgid ":ref:`PoolByteArray <class_PoolByteArray>`: An array of bytes (integers from 0 to 255)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:487
msgid ":ref:`PoolIntArray <class_PoolIntArray>`: An array of integers."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:488
msgid ":ref:`PoolRealArray <class_PoolRealArray>`: An array of floats."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:489
msgid ":ref:`PoolStringArray <class_PoolStringArray>`: An array of strings."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:490
msgid ":ref:`PoolVector2Array <class_PoolVector2Array>`: An array of :ref:`Vector2 <class_Vector2>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:491
msgid ":ref:`PoolVector3Array <class_PoolVector3Array>`: An array of :ref:`Vector3 <class_Vector3>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:492
msgid ":ref:`PoolColorArray <class_PoolColorArray>`: An array of :ref:`Color <class_Color>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:495
msgid ":ref:`Dictionary <class_Dictionary>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:497
msgid "Associative container which contains values referenced by unique keys."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:510
msgid "Lua-style table syntax is also supported. Lua-style uses ``=`` instead of ``:`` and doesn't use quotes to mark string keys (making for slightly less to write). Note however that like any GDScript identifier, keys written in this form cannot start with a digit."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:524
msgid "To add a key to an existing dictionary, access it like an existing key and assign to it::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:533
msgid "Data"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:536
msgid "Variables"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:538
msgid "Variables can exist as class members or local to functions. They are created with the ``var`` keyword and may, optionally, be assigned a value upon initialization."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:549
msgid "Variables can optionally have a type specification. When a type is specified, the variable will be forced to have always that same type, and trying to assign an incompatible value will raise an error."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:553
msgid "Types are specified in the variable declaration using a ``:`` (colon) symbol after the variable name, followed by the type."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:561
msgid "If the variable is initialized within the declaration, the type can be inferred, so it's possible to omit the type name::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:567
msgid "Type inference is only possible if the assigned value has a defined type, otherwise it will raise an error."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:570
msgid "Valid types are:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:572
msgid "Built-in types (Array, Vector2, int, String, etc.)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:573
msgid "Engine classes (Node, Resource, Reference, etc.)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:574
msgid "Constant names if they contain a script resource (``MyScript`` if you declared ``const MyScript = preload(\"res://my_script.gd\")``)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:575
msgid "Other classes in the same script, respecting scope (``InnerClass.NestedClass`` if you declared ``class NestedClass`` inside the ``class InnerClass`` in the same scope)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:576
msgid "Script classes declared with the ``class_name`` keyword."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:579
msgid "Casting"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:581
msgid "Values assigned to typed variables must have a compatible type. If it's needed to coerce a value to be of a certain type, in particular for object types, you can use the casting operator ``as``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:585
msgid "Casting between object types results in the same object if the value is of the same type or a subtype of the cast type."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:593
msgid "If the value is not a subtype, the casting operation will result in a ``null`` value."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:600
msgid "For built-in types, they will be forcibly converted if possible, otherwise the engine will raise an error."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:609
msgid "Casting is also useful to have better type-safe variables when interacting with the scene tree::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:619
msgid "Constants"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:621
msgid "Constants are similar to variables, but must be constants or constant expressions and must be assigned on initialization."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:635
msgid "Although the type of constants is inferred from the assigned value, it's also possible to add explicit type specification::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:641
msgid "Assigning a value of an incompatible type will raise an error."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:644
msgid "Enums"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:646
msgid "Enums are basically a shorthand for constants, and are pretty useful if you want to assign consecutive integers to some constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:649
msgid "If you pass a name to the enum, it will put all the keys inside a constant dictionary of that name."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:652
msgid "In Godot 3.1 and later, keys in a named enum are not registered as global constants. They should be accessed prefixed by the enum's name (``Name.KEY``); see an example below."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:672
msgid "Functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:674
msgid "Functions always belong to a `class <Classes_>`_. The scope priority for variable look-up is: local → class member → global. The ``self`` variable is always available and is provided as an option for accessing class members, but is not always required (and should *not* be sent as the function's first argument, unlike Python)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:687
msgid "A function can ``return`` at any point. The default return value is ``null``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:689
msgid "Functions can also have type specification for the arguments and for the return value. Types for arguments can be added in a similar way to variables::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:695
msgid "If a function argument has a default value, it's possible to infer the type::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:700
msgid "The return type of the function can be specified after the arguments list using the arrow token (``->``)::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:706
msgid "Functions that have a return type **must** return a proper value. Setting the type as ``void`` means the function doesn't return anything. Void functions can return early with the ``return`` keyword, but they can't return any value."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:715
msgid "Non-void functions must **always** return a value, so if your code has branching statements (such as an ``if``/``else`` construct), all the possible paths must have a return. E.g., if you have a ``return`` inside an ``if`` block but not after it, the editor will raise an error because if the block is not executed, the function won't have a valid value to return."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:723
msgid "Referencing functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:725
msgid "Contrary to Python, functions are *not* first-class objects in GDScript. This means they cannot be stored in variables, passed as an argument to another function or be returned from other functions. This is for performance reasons."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:729
msgid "To reference a function by name at run-time, (e.g. to store it in a variable, or pass it to another function as an argument) one must use the ``call`` or ``funcref`` helpers::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:743
msgid "Static functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:745
msgid "A function can be declared static. When a function is static, it has no access to the instance member variables or ``self``. This is mainly useful to make libraries of helper functions::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:754
msgid "Statements and control flow"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:756
msgid "Statements are standard and can be assignments, function calls, control flow structures, etc (see below). ``;`` as a statement separator is entirely optional."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:761
msgid "if/else/elif"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:763
msgid "Simple conditions are created by using the ``if``/``else``/``elif`` syntax. Parenthesis around conditions are allowed, but not required. Given the nature of the tab-based indentation, ``elif`` can be used instead of ``else``/``if`` to maintain a level of indentation."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:777
msgid "Short statements can be written on the same line as the condition::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:784
msgid "Sometimes, you might want to assign a different initial value based on a boolean expression. In this case, ternary-if expressions come in handy::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:793
msgid "Simple loops are created by using ``while`` syntax. Loops can be broken using ``break`` or continued using ``continue``:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:804
msgid "To iterate through a range, such as an array or table, a *for* loop is used. When iterating over an array, the current array element is stored in the loop variable. When iterating over a dictionary, the *index* is stored in the loop variable."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:839
msgid "A ``match`` statement is used to branch execution of a program. It's the equivalent of the ``switch`` statement found in many other languages, but offers some additional features."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:842
msgid "Basic syntax::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:853
msgid "**Crash-course for people who are familiar with switch statements**:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:855
msgid "Replace ``switch`` with ``match``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:856
msgid "Remove ``case``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:857
msgid "Remove any ``break``\\ s. If you don't want to ``break`` by default, you can use ``continue`` for a fallthrough."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:858
msgid "Change ``default`` to a single underscore."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:861
msgid "**Control flow**:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:863
msgid "The patterns are matched from top to bottom. If a pattern matches, the corresponding block will be executed. After that, the execution continues below the ``match`` statement. If you want to have a fallthrough, you can use ``continue`` to stop execution in the current block and check the ones below it."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:867
msgid "There are 6 pattern types:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:879
msgid "Constant pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:870
msgid "Constant primitives, like numbers and strings::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:891
msgid "Variable pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:882
msgid "Matches the contents of a variable/enum::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:905
msgid "Wildcard pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:894
msgid "This pattern matches everything. It's written as a single underscore."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:896
msgid "It can be used as the equivalent of the ``default`` in a ``switch`` statement in other languages::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:918
msgid "Binding pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:908
msgid "A binding pattern introduces a new variable. Like the wildcard pattern, it matches everything - and also gives that value a name. It's especially useful in array and dictionary patterns::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:939
msgid "Array pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:921
msgid "Matches an array. Every single element of the array pattern is a pattern itself, so you can nest them."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:923
msgid "The length of the array is tested first, it has to be the same size as the pattern, otherwise the pattern doesn't match."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:925
msgid "**Open-ended array**: An array can be bigger than the pattern by making the last subpattern ``..``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:927
msgid "Every subpattern has to be comma-separated."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:966
msgid "Dictionary pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:942
msgid "Works in the same way as the array pattern. Every key has to be a constant pattern."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:944
msgid "The size of the dictionary is tested first, it has to be the same size as the pattern, otherwise the pattern doesn't match."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:946
msgid "**Open-ended dictionary**: A dictionary can be bigger than the pattern by making the last subpattern ``..``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:948
msgid "Every subpattern has to be comma separated."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:950
msgid "If you don't specify a value, then only the existence of the key is checked."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:952
msgid "A value pattern is separated from the key pattern with a ``:``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:979
msgid "Multiple patterns"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:969
msgid "You can also specify multiple patterns separated by a comma. These patterns aren't allowed to have any bindings in them."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:982
msgid "Classes"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:984
msgid "By default, all script files are unnamed classes. In this case, you can only reference them using the file's path, using either a relative or an absolute path. For example, if you name a script file ``character.gd``::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:997
msgid "Instead, you can give your class a name to register it as a new type in Godot's editor. For that, you use the ``class_name`` keyword. You can add an optional comma followed by a path to an image, to use it as an icon. Your class will then appear with its new icon in the editor::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1010
msgid "Here's a class file example:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1029
msgid "Godot's class syntax is compact: it can only contain member variables or functions. You can use static functions, but not static member variables. In the same way, the engine initializes variables every time you create an instance, and this includes arrays and dictionaries. This is in the spirit of thread safety, since scripts can be initialized in separate threads without the user knowing."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1037
msgid "Inheritance"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1039
msgid "A class (stored as a file) can inherit from:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1041
msgid "A global class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1042
msgid "Another class file."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1043
msgid "An inner class inside another class file."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1045
msgid "Multiple inheritance is not allowed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1047
msgid "Inheritance uses the ``extends`` keyword::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1059
msgid "To check if a given instance inherits from a given class, the ``is`` keyword can be used::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1071
msgid "To call a function in a *parent class* (i.e. one ``extend``-ed in your current class), prepend ``.`` to the function name::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1076
msgid "This is especially useful because functions in extending classes replace functions with the same name in their parent classes. If you still want to call them, you can prefix them with ``.`` (like the ``super`` keyword in other languages)::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1084
msgid "Default functions like ``_init``, and most notifications such as ``_enter_tree``, ``_exit_tree``, ``_process``, ``_physics_process``, etc. are called in all parent classes automatically. There is no need to call them explicitly when overloading them."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1091
msgid "Class Constructor"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1093
msgid "The class constructor, called on class instantiation, is named ``_init``. As mentioned earlier, the constructors of parent classes are called automatically when inheriting a class. So, there is usually no need to call ``._init()`` explicitly."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1098
msgid "Unlike the call of a regular function, like in the above example with ``.some_func``, if the constructor from the inherited class takes arguments, they are passed like this::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1105
msgid "This is better explained through examples. Consider this scenario::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1125
msgid "There are a few things to keep in mind here:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1127
msgid "If the inherited class (``State.gd``) defines a ``_init`` constructor that takes arguments (``e`` in this case), then the inheriting class (``Idle.gd``) *must* define ``_init`` as well and pass appropriate parameters to ``_init`` from ``State.gd``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1130
msgid "``Idle.gd`` can have a different number of arguments than the parent class ``State.gd``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1131
msgid "In the example above, ``e`` passed to the ``State.gd`` constructor is the same ``e`` passed in to ``Idle.gd``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1133
msgid "If ``Idle.gd``'s ``_init`` constructor takes 0 arguments, it still needs to pass some value to the ``State.gd`` parent class, even if it does nothing. This brings us to the fact that you can pass literals in the base constructor as well, not just variables. eg.::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1143
msgid "Inner classes"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1145
msgid "A class file can contain inner classes. Inner classes are defined using the ``class`` keyword. They are instanced using the ``ClassName.new()`` function."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1165
msgid "Classes as resources"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1167
msgid "Classes stored as files are treated as :ref:`resources <class_GDScript>`. They must be loaded from disk to access them in other classes. This is done using either the ``load`` or ``preload`` functions (see below). Instancing of a loaded class resource is done by calling the ``new`` function on the class object::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1183
msgid "Exports"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1187
msgid "Documentation about exports has been moved to :ref:`doc_gdscript_exports`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1190
msgid "Setters/getters"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1192
msgid "It is often useful to know when a class' member variable changes for whatever reason. It may also be desired to encapsulate its access in some way."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1195
msgid "For this, GDScript provides a *setter/getter* syntax using the ``setget`` keyword. It is used directly after a variable definition:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1202
msgid "Whenever the value of ``variable`` is modified by an *external* source (i.e. not from local usage in the class), the *setter* function (``setterfunc`` above) will be called. This happens *before* the value is changed. The *setter* must decide what to do with the new value. Vice versa, when ``variable`` is accessed, the *getter* function (``getterfunc`` above) must ``return`` the desired value. Below is an example::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1216
msgid "Either of the *setter* or *getter* functions can be omitted::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1223
msgid "Setters and getters are useful when :ref:`exporting variables <doc_gdscript_exports>` to the editor in tool scripts or plugins, for validating input."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1226
msgid "As said, *local* access will *not* trigger the setter and getter. Here is an illustration of this:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1243
msgid "Tool mode"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1245
msgid "By default, scripts don't run inside the editor and only the exported properties can be changed. In some cases, it is desired that they do run inside the editor (as long as they don't execute game code or manually avoid doing so). For this, the ``tool`` keyword exists and must be placed at the top of the file::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1257
msgid "Be cautious when freeing nodes with ``queue_free()`` or ``free()`` in a tool script (especially the script's owner itself). As tool scripts run their code in the editor, misusing them may lead to crashing the editor."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1263
msgid "Memory management"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1265
msgid "If a class inherits from :ref:`class_Reference`, then instances will be freed when no longer in use. No garbage collector exists, just reference counting. By default, all classes that don't define inheritance extend **Reference**. If this is not desired, then a class must inherit :ref:`class_Object` manually and must call instance.free(). To avoid reference cycles that can't be freed, a ``weakref`` function is provided for creating weak references."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1273
msgid "Alternatively, when not using references, the ``is_instance_valid(instance)`` can be used to check if an object has been freed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1280
msgid "Signals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1282
msgid "Signals are a tool to emit messages from an object that other objects can react to. To create custom signals for a class, use the ``signal`` keyword."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1294
msgid "Signals are a `Callback <https://en.wikipedia.org/wiki/Callback_(computer_programming)>`_ mechanism. They also fill the role of Observers, a common programming pattern. For more information, read the `Observer tutorial <https://gameprogrammingpatterns.com/observer.html>`_ in the Game Programming Patterns ebook."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1301
msgid "You can connect these signals to methods the same way you connect built-in signals of nodes like :ref:`class_Button` or :ref:`class_RigidBody`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1304
msgid "In the example below, we connect the ``health_depleted`` signal from a ``Character`` node to a ``Game`` node. When the ``Character`` node emits the signal, the game node's ``_on_Character_health_depleted`` is called::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1317
msgid "You can emit as many arguments as you want along with a signal."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1319
msgid "Here is an example where this is useful. Let's say we want a life bar on screen to react to health changes with an animation, but we want to keep the user interface separate from the player in our scene tree."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1323
msgid "In our ``Character.gd`` script, we define a ``health_changed`` signal and emit it with :ref:`Object.emit_signal() <class_Object_method_emit_signal>`, and from a ``Game`` node higher up our scene tree, we connect it to the ``Lifebar`` using the :ref:`Object.connect() <class_Object_method_connect>` method::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1363
msgid "To use signals, your class has to extend the ``Object`` class or any type extending it like ``Node``, ``KinematicBody``, ``Control``..."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1366
msgid "In the ``Game`` node, we get both the ``Character`` and ``Lifebar`` nodes, then connect the character, that emits the signal, to the receiver, the ``Lifebar`` node in this case."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1380
msgid "This allows the ``Lifebar`` to react to health changes without coupling it to the ``Character`` node."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1383
msgid "You can write optional argument names in parentheses after the signal's definition::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1389
msgid "These arguments show up in the editor's node dock, and Godot can use them to generate callback functions for you. However, you can still emit any number of arguments when you emit signals; it's up to you to emit the correct values."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1395
msgid "GDScript can bind an array of values to connections between a signal and a method. When the signal is emitted, the callback method receives the bound values. These bound arguments are unique to each connection, and the values will stay the same."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1400
msgid "You can use this array of values to add extra constant information to the connection if the emitted signal itself doesn't give you access to all the data that you need."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1404
msgid "Building on the example above, let's say we want to display a log of the damage taken by each character on the screen, like ``Player1 took 22 damage.``. The ``health_changed`` signal doesn't give us the name of the character that took damage. So when we connect the signal to the in-game console, we can add the character's name in the binds array argument::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1418
msgid "Our ``BattleLog`` node receives each element in the binds array as an extra argument::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1430
msgid "Coroutines with yield"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1432
msgid "GDScript offers support for `coroutines <https://en.wikipedia.org/wiki/Coroutine>`_ via the :ref:`yield<class_@GDScript_method_yield>` built-in function. Calling ``yield()`` will immediately return from the current function, with the current frozen state of the same function as the return value. Calling ``resume()`` on this resulting object will continue execution and return whatever the function returns. Once resumed, the state object becomes invalid. Here is an example::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1452
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1472
msgid "Will print::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1458
msgid "It is also possible to pass values between ``yield()`` and ``resume()``, for example::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1479
msgid "Coroutines & signals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1481
msgid "The real strength of using ``yield`` is when combined with signals. ``yield`` can accept two arguments, an object and a signal. When the signal is received, execution will recommence. Here are some examples::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1494
msgid "Coroutines themselves use the ``completed`` signal when they transition into an invalid state, for example::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1505
msgid "``my_func`` will only continue execution once both buttons have been pressed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1508
msgid "Onready keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1510
msgid "When using nodes, it's common to desire to keep references to parts of the scene in a variable. As scenes are only warranted to be configured when entering the active scene tree, the sub-nodes can only be obtained when a call to ``Node._ready()`` is made."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1522
msgid "This can get a little cumbersome, especially when nodes and external references pile up. For this, GDScript has the ``onready`` keyword, that defers initialization of a member variable until ``_ready()`` is called. It can replace the above code with a single line::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1530
msgid "Assert keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1532
msgid "The ``assert`` keyword can be used to check conditions in debug builds. These assertions are ignored in non-debug builds. This means that the expression passed as argument won't be evaluated in a project exported in release mode. Due to this, assertions must **not** contain expressions that have side effects. Otherwise, the behavior of the script would vary depending on whether the project is run in a debug build."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1544
msgid "When running a project from the editor, the project will be paused if an assertion error occurs."
msgstr ""