Files
godot-docs-l10n/sphinx/templates/getting_started/scripting/gdscript/gdscript_basics.pot
2018-09-09 12:15:48 +02:00

1409 lines
58 KiB
Plaintext

# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2014-2018, 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: 2018-09-09 12:15+0200\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"
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 <http://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:127
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:132
msgid "Language"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:134
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:139
msgid "Identifiers"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:141
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:147
msgid "Keywords"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:149
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:154
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:158
msgid "Keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:158
msgid "Description"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:160
msgid "if"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:160
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:162
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:164
msgid "See `if/else/elif`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:162
msgid "elif"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:164
msgid "else"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:166
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:705
msgid "for"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:166
msgid "See for_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:168
msgid "do"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:168
msgid "Reserved for future implementation of do...while loops."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:170
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:694
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:734
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 "switch"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:174
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:176
msgid "Reserved for future implementation."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:176
msgid "case"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:178
msgid "break"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:178
msgid "Exits the execution of the current ``for`` or ``while`` loop."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:180
msgid "continue"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:180
msgid "Immediately skips to the next iteration of the ``for`` or ``while`` loop."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:182
msgid "pass"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:182
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:184
msgid "return"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:184
msgid "Returns a value from a function."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:186
msgid "class"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:186
msgid "Defines a class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:188
msgid "extends"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:188
msgid "Defines what class to extend with the current class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:190
msgid "is"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:190
msgid "Tests whether a variable extends a given class."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:192
msgid "self"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:192
msgid "Refers to current class instance."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:194
msgid "tool"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:194
msgid "Executes the script in the editor."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:196
msgid "signal"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:196
msgid "Defines a signal."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:198
msgid "func"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:198
msgid "Defines a function."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:200
msgid "static"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:200
msgid "Defines a static function. Static member variables are not allowed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:202
msgid "const"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:202
msgid "Defines a constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:204
msgid "enum"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:204
msgid "Defines an enum."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:206
msgid "var"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:206
msgid "Defines a variable."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:208
msgid "onready"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:208
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:210
msgid "export"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:210
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:212
msgid "setget"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:212
msgid "Defines setter and getter functions for a variable."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:214
msgid "breakpoint"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:214
msgid "Editor helper for debugger breakpoints."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:216
msgid "preload"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:216
msgid "Preloads a class or variable. See `Classes as resources`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:218
msgid "yield"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:218
msgid "Coroutine support. See `Coroutines with yield`_."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:220
msgid "assert"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:220
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:222
msgid "remote"
msgstr ""
#: ../../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
msgid "Networking RPC annotation. See :ref:`high-level multiplayer docs <doc_high_level_multiplayer>`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:224
msgid "master"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:226
msgid "slave"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:228
msgid "sync"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:230
msgid "PI"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:230
msgid "PI constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:232
msgid "TAU"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:232
msgid "TAU constant."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:234
msgid "INF"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:234
msgid "Infinity constant. Used for comparisons."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:236
msgid "NAN"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:236
msgid "NAN (not a number) constant. Used for comparisons."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:240
msgid "Operators"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:242
msgid "The following is the list of supported operators and their precedence."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:245
msgid "**Operator**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:245
msgid "**Description**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:247
msgid "``x[index]``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:247
msgid "Subscription, Highest Priority"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:249
msgid "``x.attribute``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:249
msgid "Attribute Reference"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:251
msgid "``is``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:251
msgid "Instance Type Checker"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:253
msgid "``~``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:253
msgid "Bitwise NOT"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:255
msgid "``-x``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:255
msgid "Negative / Unary Negation"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:257
msgid "``*`` ``/`` ``%``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:257
msgid "Multiplication / Division / Remainder"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:259
msgid "NOTE: The result of these operations depends on the operands types. If both are Integers, then the result will be an Integer. That means 1/10 returns 0 instead of 0.1. If at least one of the operands is a float, then the result is a float: float(1)/10 or 1.0/10 return both 0.1. NOTE2: Remainder/Modulo only works on int. For floats use built in fmod()"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:270
msgid "``+``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:270
msgid "Addition / Concatenation of Arrays"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:272
msgid "``-``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:272
msgid "Subtraction"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:274
msgid "``<<`` ``>>``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:274
msgid "Bit Shifting"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:276
msgid "``&``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:276
msgid "Bitwise AND"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:278
msgid "``^``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:278
msgid "Bitwise XOR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:280
msgid "``|``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:280
msgid "Bitwise OR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:282
msgid "``<`` ``>`` ``==`` ``!=`` ``>=`` ``<=``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:282
msgid "Comparisons"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:284
msgid "``in``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:284
msgid "Content Test"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:286
msgid "``!`` ``not``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:286
msgid "Boolean NOT"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:288
msgid "``and`` ``&&``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:288
msgid "Boolean AND"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:290
msgid "``or`` ``||``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:290
msgid "Boolean OR"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:292
msgid "``if x else``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:292
msgid "Ternary if/else"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:294
msgid "``=`` ``+=`` ``-=`` ``*=`` ``/=`` ``%=`` ``&=`` ``|=``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:294
msgid "Assignment, Lowest Priority"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:298
msgid "Literals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:301
msgid "**Literal**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:301
msgid "**Type**"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:303
msgid "``45``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:303
msgid "Base 10 integer"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:305
msgid "``0x8F51``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:305
msgid "Base 16 (hex) integer"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:307
msgid "``3.14``, ``58.1e-10``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:307
msgid "Floating point number (real)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:309
msgid "``\"Hello\"``, ``\"Hi\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:309
msgid "Strings"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:311
msgid "``\"\"\"Hello\"\"\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:311
msgid "Multiline string"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:313
msgid "``@\"Node/Label\"``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:313
msgid "NodePath or StringName"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:315
msgid "``$NodePath``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:315
msgid "Shorthand for ``get_node(\"NodePath\")``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:319
msgid "Comments"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:321
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:329
msgid "Multi-line comments can be created using \"\"\" (three quotes in a row) at the beginning and end of a block of text. Note that this creates a string, therefore, it will not be stripped away when the script is compiled."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:340
msgid "Built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:342
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. (Not ``PoolArray``\\ s like ``PoolByteArray`` though, those are passed as values too, so consider this when deciding which to use!)"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:349
msgid "Basic built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:351
msgid "A variable in GDScript can be assigned to several built-in types."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:354
msgid "null"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:356
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:360
msgid "bool"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:362
msgid "The Boolean data type can only contain ``true`` or ``false``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:365
msgid "int"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:367
msgid "The integer data type can only contain integer numbers, (both negative and positive)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:371
msgid "float"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:373
msgid "Used to contain a floating point value (real numbers)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:376
msgid ":ref:`String <class_String>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:378
msgid "A sequence of characters in `Unicode format <https://en.wikipedia.org/wiki/Unicode>`_. Strings can contain the `standard C escape sequences <https://en.wikipedia.org/wiki/Escape_sequences_in_C>`_. GDScript supports :ref:`format strings aka printf functionality <doc_gdscript_printf>`."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:384
msgid "Vector built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:387
msgid ":ref:`Vector2 <class_Vector2>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:389
msgid "2D vector type containing ``x`` and ``y`` fields. Can also be accessed as array."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:393
msgid ":ref:`Rect2 <class_Rect2>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:395
msgid "2D Rectangle type containing two vectors fields: ``position`` and ``size``. Alternatively contains an ``end`` field which is ``position+size``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:399
msgid ":ref:`Vector3 <class_Vector3>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:401
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:405
msgid ":ref:`Transform2D <class_Transform2D>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:407
msgid "3x2 matrix used for 2D transforms."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:410
msgid ":ref:`Plane <class_Plane>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:412
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:416
msgid ":ref:`Quat <class_Quat>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:418
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:422
msgid ":ref:`AABB <class_AABB>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:424
msgid "Axis-aligned bounding box (or 3D box) contains 2 vectors fields: ``position`` and ``size``. Alternatively contains an ``end`` field which is ``position+size``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:429
msgid ":ref:`Basis <class_Basis>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:431
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:436
msgid ":ref:`Transform <class_Transform>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:438
msgid "3D Transform contains a Basis field ``basis`` and a Vector3 field ``origin``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:442
msgid "Engine built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:445
msgid ":ref:`Color <class_Color>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:447
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:451
msgid ":ref:`NodePath <class_NodePath>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:453
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:457
msgid ":ref:`RID <class_RID>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:459
msgid "Resource ID (RID). Servers use generic RIDs to reference opaque data."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:462
msgid ":ref:`Object <class_Object>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:464
msgid "Base class for anything that is not a built-in type."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:467
msgid "Container built-in types"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:470
msgid ":ref:`Array <class_Array>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:472
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``. Starting with Godot 2.1, indices may be negative like in Python, to count from the end."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:486
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 also 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:493
msgid ":ref:`PoolByteArray <class_PoolByteArray>`: An array of bytes (integers from 0 to 255)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:494
msgid ":ref:`PoolIntArray <class_PoolIntArray>`: An array of integers."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:495
msgid ":ref:`PoolRealArray <class_PoolRealArray>`: An array of floats."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:496
msgid ":ref:`PoolStringArray <class_PoolStringArray>`: An array of strings."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:497
msgid ":ref:`PoolVector2Array <class_PoolVector2Array>`: An array of :ref:`Vector2 <class_Vector2>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:498
msgid ":ref:`PoolVector3Array <class_PoolVector3Array>`: An array of :ref:`Vector3 <class_Vector3>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:499
msgid ":ref:`PoolColorArray <class_PoolColorArray>`: An array of :ref:`Color <class_Color>` objects."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:502
msgid ":ref:`Dictionary <class_Dictionary>`"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:504
msgid "Associative container which contains values referenced by unique keys."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:517
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:531
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:540
msgid "Data"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:543
msgid "Variables"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:545
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:557
msgid "Constants"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:559
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:573
msgid "Enums"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:575
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:578
msgid "If you pass a name to the enum, it would also put all the values inside a constant dictionary of that name."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:599
msgid "Functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:601
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:614
msgid "A function can ``return`` at any point. The default return value is ``null``."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:617
msgid "Referencing Functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:619
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:623
msgid "To reference a function by name at runtime, (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:636
msgid "Remember that default functions like ``_init``, and most notifications such as ``_enter_tree``, ``_exit_tree``, ``_process``, ``_physics_process``, etc. are called in all base classes automatically. So there is only a need to call the function explicitly when overloading them in some way."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:644
msgid "Static functions"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:646
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:657
msgid "Statements and control flow"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:659
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:664
msgid "if/else/elif"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:666
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:680
msgid "Short statements can be written on the same line as the condition::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:687
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:696
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:707
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:736
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:739
msgid "Basic syntax:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:752
msgid "**Crash-course for people who are familiar to switch statements**:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:754
msgid "Replace ``switch`` with ``match``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:755
msgid "Remove ``case``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:756
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:757
msgid "Change ``default`` to a single underscore."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:760
msgid "**Control flow**:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:762
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:766
msgid "There are 6 pattern types:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:778
msgid "constant pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:769
msgid "constant primitives, like numbers and strings ::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:790
msgid "variable pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:781
msgid "matches the contents of a variable/enum ::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:804
msgid "wildcard pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:793
msgid "This pattern matches everything. It's written as a single underscore."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:795
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:817
msgid "binding pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:807
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:836
msgid "array pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:820
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:822
msgid "The length of the array is tested first, it has to be the same size as the pattern, otherwise the pattern don't match."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:824
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:826
msgid "Every subpattern has to be comma separated. ::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:861
msgid "dictionary pattern"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:839
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:841
msgid "The size of the dictionary is tested first, it has to be the same size as the pattern, otherwise the pattern don't match."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:843
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:845
msgid "Every subpattern has to be comma separated."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:847
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:849
msgid "A value pattern is separated from the key pattern with a ``:`` ::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:872
msgid "Multipatterns:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:864
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:875
msgid "Classes"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:877
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:892
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:907
msgid "Here's a class file example:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:926
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:934
msgid "Inheritance"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:936
msgid "A class (stored as a file) can inherit from"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:938
msgid "A global class"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:939
msgid "Another class file"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:940
msgid "An inner class inside another class file."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:942
msgid "Multiple inheritance is not allowed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:944
msgid "Inheritance uses the ``extends`` keyword:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:958
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:972
msgid "To call a function in a *base class* (i.e. one ``extend``-ed in your current class), prepend ``.`` to the function name:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:979
msgid "This is especially useful because functions in extending classes replace functions with the same name in their base classes. So if you still want to call them, you can use ``.`` like the ``super`` keyword in other languages:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:989
msgid "Class Constructor"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:991
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:995
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:1003
msgid "This is better explained through examples. Say we have this scenario:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1025
msgid "There are a few things to keep in mind here:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1027
msgid "if the inherited class (``State.gd``) defines a ``_init`` constructor that takes arguments (``e`` in this case) then the inheriting class (``Idle.gd``) *has* to define ``_init`` as well and pass appropriate parameters to ``_init`` from ``State.gd``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1030
msgid "``Idle.gd`` can have a different number of arguments than the base class ``State.gd``"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1031
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:1033
msgid "if ``Idle.gd``'s ``_init`` constructor takes 0 arguments it still needs to pass some value to the ``State.gd`` base class even if it does nothing. Which 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:1045
msgid "Inner classes"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1047
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:1067
msgid "Classes as resources"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1069
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:1085
msgid "Exports"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1087
msgid "Class members can be exported. This means their value gets saved along with the resource (e.g. the :ref:`scene <class_PackedScene>`) they're attached to. They will also be available for editing in the property editor. Exporting is done by using the ``export`` keyword::"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1096
msgid "An exported variable must be initialized to a constant expression or have an export hint in the form of an argument to the export keyword (see below)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1099
msgid "One of the fundamental benefits of exporting member variables is to have them visible and editable in the editor. This way artists and game designers can modify values that later influence how the program runs. For this, a special export syntax is provided."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1185
msgid "It must be noted that even if the script is not being run while at the editor, the exported properties are still editable (see below for \"tool\")."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1190
msgid "Exporting bit flags"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1192
msgid "Integers used as bit flags can store multiple ``true``/``false`` (boolean) values in one property. By using the export hint ``int, FLAGS``, they can be set from the editor:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1201
msgid "Restricting the flags to a certain number of named flags is also possible. The syntax is similar to the enumeration syntax:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1209
msgid "In this example, ``Fire`` has value 1, ``Water`` has value 2, ``Earth`` has value 4 and ``Wind`` corresponds to value 8. Usually, constants should be defined accordingly (e.g. ``const ELEMENT_WIND = 8`` and so on)."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1214
msgid "Using bit flags requires some understanding of bitwise operations. If in doubt, boolean variables should be exported instead."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1218
msgid "Exporting arrays"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1220
msgid "Exporting arrays works but with an important caveat: While regular arrays are created local to every class instance, exported arrays are *shared* between all instances. This means that editing them in one instance will cause them to change in all other instances. Exported arrays can have initializers, but they must be constant expressions."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1257
msgid "Setters/getters"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1259
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:1262
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:1269
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:1286
msgid "Either of the *setter* or *getter* functions can be omitted:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1295
msgid "Get/Setters are especially useful when exporting variables to editor in tool scripts or plugins, for validating input."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1298
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:1313
msgid "Tool mode"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1315
msgid "Scripts, by default, 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:1330
msgid "Memory management"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1332
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:1340
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:1345
msgid "Signals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1347
msgid "It is often desired to send a notification that something happened in an instance. GDScript supports creation of built-in Godot signals. Declaring a signal in GDScript is easy using the `signal` keyword."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1358
msgid "These signals can be connected in the editor or from code like regular signals. Take the instance of a class where the signal was declared and connect it to the method of another instance:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1374
msgid "It is also possible to bind arguments to a signal that lacks them with your custom values:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1382
msgid "This is useful when a signal from many objects is connected to a single callback and the sender must be identified:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1394
msgid "Finally, emitting a custom signal is done by using the Object.emit_signal method:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1405
msgid "Coroutines with yield"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1407
msgid "GDScript offers support for `coroutines <https://en.wikipedia.org/wiki/Coroutine>`_ via the ``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:1429
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1453
msgid "Will print:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1437
msgid "It is also possible to pass values between yield() and resume(), for example:"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1462
msgid "Coroutines & signals"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1464
msgid "The real strength of using ``yield`` is when combined with signals. ``yield`` can accept two parameters, 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:1479
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:1492
msgid "``my_func`` will only continue execution once both the buttons are pressed."
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1495
msgid "Onready keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1497
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:1509
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:1519
msgid "Assert keyword"
msgstr ""
#: ../../docs/getting_started/scripting/gdscript/gdscript_basics.rst:1521
msgid "The ``assert`` keyword can be used to check conditions in debug builds. These assertions are ignored in non-debug builds."
msgstr ""