GDScript Support Reference
GDCC supports mixed typed and weakly typed GDScript. Properties, locals, parameters, and return values may use explicit types, or may omit them and use Variant. Variant is the dynamic value boundary. Use explicit types when you want earlier assignment, call-argument, and return checks.
var typed_score: int = 10var dynamic_payload
func mix(value, count: int) -> Variant: var local := count + 1 dynamic_payload = value return localDynamic typing
Section titled “Dynamic typing”Variant is supported. The following positions usually become Variant when the type is omitted:
- Function parameters.
- Function return values.
- Class properties.
- Some local variables.
func echo(value): return value
func reopen(seed: Variant) -> int: return int(seed)Supported Variant boundaries:
- A concrete type assigned to
Variant. Variantassigned to a concrete target type.Variantused as a dynamic call target.- A
Variantreturn value assigned to an explicitly typed variable.
Built-in types
Section titled “Built-in types”Supported declared type families:
| Group | Types |
|---|---|
| empty / dynamic / no return | Nil, null, Variant, void, Void |
| scalar | bool, int, float |
| string-like | String, StringName, NodePath |
| math and geometry | Vector2, Vector2i, Vector3, Vector3i, Vector4, Vector4i, Rect2, Rect2i, Transform2D, Transform3D, Plane, Quaternion, AABB, Basis, Projection, Color |
| handle and callable | RID, Callable, Signal |
| containers | Array, Dictionary |
| packed arrays | PackedByteArray, PackedInt32Array, PackedInt64Array, PackedFloat32Array, PackedFloat64Array, PackedStringArray, PackedVector2Array, PackedVector3Array, PackedVector4Array, PackedColorArray |
| objects | Object, engine classes, GDCC script classes, visible inner classes |
Typed containers
Section titled “Typed containers”Array[T] and Dictionary[K, V] are supported.
var nodes: Array[Node]var workers: Array[Worker]var payloads: Dictionary[StringName, Node]Supported rules:
Arrayis a plain dynamic array.Dictionaryis a plain dynamic dictionary.TinArray[T]must be a resolvable leaf type.KandVinDictionary[K, V]must be resolvable leaf types.- Leaf container names are allowed, such as
Array[Array].
Anonymous and named enums are supported.
enum { MODE_IDLE, MODE_RUNNING }enum State { IDLE, JUMP = 5, FALL }
func current_state() -> State: return State.JUMP
func state_values() -> Array: return State.values()Supported:
- Anonymous enum members are available by bare name and have type
int. - Named enum members are accessed as
State.IDLE. - A named enum is a
Dictionaryin value position and supportskeys()andvalues(). - A named enum can be used as a type annotation, such as
var state: StateorArray[State]; it behaves asint. - Cross-class access is supported, such as
Other.State.IDLEandOther.IDLE. - Member values may use integer constant expressions with
+,-,*,/,%, shifts, and bitwise operators. - Member values may reference earlier members in the same enum and earlier enum constants in the same class.
Limitations:
enummay only be declared in a class body or inner class body, not inside a function.- Member values cannot call functions, access properties, use a conditional expression, or use
**. - Member values cannot reference enum constants declared by a parent class.
- A named enum is not a separate runtime type; do not rely on type distinctions between different enums.
Supported type compatibility
Section titled “Supported type compatibility”| Source | Target | Status |
|---|---|---|
| same type | same type | supported |
int | float | supported |
Vector2i / Vector3i / Vector4i | same-dimension Vector2 / Vector3 / Vector4 | supported |
String | StringName | supported |
StringName | String | supported |
| any stable type | Variant | supported |
Variant | concrete type | supported |
| object subclass | object superclass | supported |
null | object type | supported |
Array[Child] | Array[Parent] | limited |
Dictionary[K1, V1] | Dictionary[K2, V2] | limited |
The int to float rule applies where an explicit float type is expected, including assignments, property initialization, call arguments, return values, builtin constructor float arguments, and Dictionary[float, V] keys.
The same boundary shape applies to same-dimension integer vectors where the matching float-vector type is expected, including assignments, property initialization, call arguments, return values, builtin constructors, keys such as Dictionary[Vector3, V], and values such as Dictionary[K, Vector3]. Dynamic calls from Godot may also pass an int to a float parameter, or a same-dimension integer vector to a float-vector parameter; the parameter type still appears as the declared target type.
String and StringName are interchangeable at typed boundaries in both directions, including assignments, property initialization, call arguments, return values, and typed Dictionary keys such as Dictionary[StringName, V] or Dictionary[String, V]. Dynamic calls from Godot that go through a Variant wrapper also pass String to a StringName parameter, and vice versa.
var ratio: float = 1var offset: Vector3 = Vector3i(1, 2, 3)var ready_name: StringName = "ready"
func take_float(value: float) -> float: return value
func take_vector(value: Vector3) -> float: return value.x + value.y + value.z
func take_name(value: StringName) -> StringName: return value
func compute(scores: Dictionary[float, int], vectors: Dictionary[Vector3, int], names: Dictionary[StringName, int]) -> float: scores[2] = 7 vectors[Vector3i(1, 2, 3)] = 9 names["ready"] = 1 return take_float(3) + take_vector(Vector3i(4, 5, 6)) + take_name(ready_name) + names[&"ready"]Unsupported common conversions:
float -> int.bool -> int.bool -> float.String -> NodePath,NodePath -> String, andNodePath -> StringName.Vector2 -> Vector2i,Vector3 -> Vector3i, andVector4 -> Vector4i.- vector conversions with mismatched dimensions, such as
Vector2i -> Vector3. Rect2i -> Rect2andRect2 -> Rect2i.Array[int] -> Array[float].Array[Vector3i] -> Array[Vector3].Dictionary[int, V] -> Dictionary[float, V].Dictionary[Vector3i, V] -> Dictionary[Vector3, V].- enums as separate runtime types in compatibility checks.
Files and classes
Section titled “Files and classes”Top-level script class
Section titled “Top-level script class”Each .gd file corresponds to one top-level script class.
class_name Playerextends Node
var hp: int = 100Supported:
class_name Player.class_name Player extends Node.- Standalone top-level
extends Node. - Omitted
class_name, with a class name derived from the file name. - Omitted
extends, defaulting toRefCounted.
Unsupported:
extends "res://player_base.gd".- Path-based superclass binding loaded by the interpreter.
- Autoload superclass binding.
- Cross-module superclass binding.
- Complex superclass expressions.
- Attaching a GDCC script directly to an existing node; change the node type to the corresponding GDCC class instead.
Inner classes
Section titled “Inner classes”Inner classes and multi-level inner classes are supported.
class_name Outerextends Node
class Worker extends RefCounted: var value: int
func read_value() -> int: return value
func make_worker() -> Worker: return Worker.new()Supported:
class Worker:.class Worker extends RefCounted:.- Inner classes containing further inner classes.
- Inner classes as type annotations.
- Inner classes declaring properties, signals, functions, and static functions.
Static variables
Section titled “Static variables”Script class static var is supported.
class_name Counterextends RefCounted
static var total: int = 0static var labels: Array[String] = []
static func add(amount: int) -> void: total += amountSupported:
- Bare reads and writes inside the class, such as
total. - Qualified reads and writes, such as
Counter.total. - Access through an instance, such as
self.totalorobj.total, operates on the declaring class’s shared storage; this form produces a warning. - A subclass accessing a parent
static varshares the same storage. static varin inner classes.static varinitializers that access other static members, global constants, singletons, and supported calls.
Limitations:
@exportand@onreadycannot be used onstatic var.- Static setters/getters are not supported.
_static_init()is not called automatically.
Inheritance, polymorphism, and super
Section titled “Inheritance, polymorphism, and super”A GDCC script class can inherit from any engine class or a class provided by another GDExtension, and can also inherit from another GDCC script class in the same module. A subclass can override a parent instance method with the same signature, and calls through a parent-typed reference dispatch to the subclass implementation.
class_name Armyextends Node
class Unit extends RefCounted: func describe() -> String: return "unit"
class Soldier extends Unit: func describe() -> String: return "soldier:" + super.describe()
func describe_unit(unit: Unit) -> String: return unit.describe()Supported:
- Inheriting from engine classes and classes provided by other GDExtensions.
- Inheritance between GDCC classes in the same module.
- Same-signature instance method overrides and polymorphic calls; parameter count, parameter types, and return type must match.
super.method(...)to call the parent implementation.- Bare
super(...)to call the parent method of the same name. super.method(...)inside a lambda, which implicitly captures the current instance.- Engine virtual overrides, described below.
Limitations:
- Cross-module GDCC superclasses are not supported.
super.propertyandsuper[index]are not supported.- Explicit
super(...)constructor calls andsuper._init(...)are not supported; GDCC automatically chains the parent_init. - Bare
super(...)cannot be used inside a lambda; usesuper.method(...)there instead. supercannot be used in static functions.finalor override-prevention semantics are not supported.
Annotations
Section titled “Annotations”Script-level @tool, the @export family, and @onready are supported.
@toolclass_name EditorProbeextends Node
@export var speed: float = 1.0@export_range(0, 100, 1) var health: int = 100@export_enum("Warrior", "Mage") var job: int = 0@export_file("*.png") var icon_path: String@onready var target: NodeThe @export family
Section titled “The @export family”Supported:
@export@export_range@export_enum@export_flags@export_flags_2d_render,@export_flags_2d_physics,@export_flags_2d_navigation@export_flags_3d_render,@export_flags_3d_physics,@export_flags_3d_navigation@export_flags_avoidance@export_file,@export_file_path,@export_dir@export_global_file,@export_global_dir@export_multiline,@export_placeholder@export_exp_easing@export_color_no_alpha@export_node_path
Rules:
- Only class properties declared with
var; notstatic var. - Annotation arguments accept literals only, not constant names or expressions.
- Each
@export_*variant has property type requirements. For example,@export_rangeis forint/float,@export_fileis forString,@export_color_no_alphais forColor, and@export_node_pathis forNodePath. - Bare
@exportsupports built-in types,Resource,Node, and script enums. Exporting aNode-derived type requires the containing class to inheritNode. - When a property uses a named enum type, bare
@exportgenerates an enum dropdown in the editor. - Do not apply
@export_*variants to container properties.
- May only appear at the top of the script, before
extendsandclass_name. - Accepts no arguments.
@toolpropagates to the script’s top-level class and inner classes._processand_physics_processdo not run in the editor for non-@toolclasses; other callbacks still run. Runtime behavior is unaffected.
@onready
Section titled “@onready”- Only class properties declared with
var. - Not
static var. - The owner class must inherit
Node.
Members
Section titled “Members”Properties
Section titled “Properties”var score: int = 0var payload: Variantvar values: Array[int]var worker: Worker = Worker.new()Supported forms:
var namevar name = valuevar name: Typevar name: Type = valuevar name := value@export var name: Type@onready var name: Typestatic var name: Typestatic var name: Type = value
Notes:
- Prefer explicit types for properties.
- Properties without an explicit type are treated as
Variant. - Property
:=currently also produces aVariantproperty. - Property initializers support common expressions, constructor calls, static constants, static calls, and chained access.
- Property initializers must not read the current instance’s non-static properties, signals, instance methods, or
self. - Property initializers cannot contain lambdas.
- Property initializers cannot use
$Nodeor%UniqueName. constis still unsupported.
Signals
Section titled “Signals”signal changed(value: int)signal ready()
func announce() -> void: changed.emit(1)
func listen() -> void: changed.connect(func(value: int) -> void: print(value))Supported:
- Signals with no parameters and signals with typed parameters.
- Signals as first-class
Signalvalues, such aschanged,self.changed, orobj.changed. signal.emit(...), with any number of arguments.signal.connect(callable),signal.connect(callable, flags), andsignal.disconnect(callable).- Instance methods, static methods, utility functions, and lambdas as
Callable. await signal.
Notes:
- Parameters in a signal declaration are editor and engine metadata;
emitdoes not check argument count or types against the declared signature. connectflags use qualified forms, such asObject.CONNECT_ONE_SHOT.
Functions
Section titled “Functions”func add(a: int, b: int) -> int: return a + b
static func build() -> Worker: return Worker.new()
func _init() -> void: passSupported forms:
- Instance functions.
static func.- Explicit parameter types.
- Omitted parameter types, making parameters
Variant. - Explicit return types.
- Omitted return types, making the return slot
Variant. - Zero-argument
_init. - Parameter defaults.
- Lambda expressions and nested lambdas.
Parameter default rules:
- Trailing consecutive defaults are supported, such as
func f(a: int, b: int = 5) -> int:. - A parameter without a default cannot follow a parameter with a default.
- Defaults are re-evaluated on every call.
- Defaults may be ordinary expressions such as literals, container literals, constructor calls, member access, and function calls.
- Instance method defaults may reference
selfand instance members; static method defaults may not. - Defaults cannot reference parameters, locals, or lambda captures.
- An untyped parameter is not inferred from its default; it remains
Variant. _initparameter defaults are not supported.- Lambda parameter defaults are not supported.
Unsupported or limited forms:
- Parameterized
.new(...)on GDCC custom classes. - Relying on a parameterized
_initbeing called automatically by.new(...).
Engine virtual functions
Section titled “Engine virtual functions”Engine virtual function overrides are supported, and the signature must match exactly.
func _ready() -> void: pass
func _process(delta: float) -> void: pass
func _physics_process(delta: float) -> void: passImportant:
_process(delta)is not equivalent to_process(delta: float)._physics_process(delta)is not equivalent to_physics_process(delta: float).- Virtual functions must be instance functions.
- Parameter count, parameter types, and return type must match.
Statements
Section titled “Statements”pass and comments
Section titled “pass and comments”func noop() -> void: passSupported:
pass- Ordinary comments.
Local variables
Section titled “Local variables”func compute(seed: int) -> int: var value: int = seed + 1 var dynamic_value = value var inferred := value * 2 return inferredSupported forms:
var namevar name = valuevar name: Typevar name: Type = valuevar name := value
Unsupported forms:
const local_value = 1- Declaring the same local name twice in the same scope.
Assignment
Section titled “Assignment”func update(values: Array) -> void: var local: int = 1 local = local + 1 values[0] = local self.hp = localSupported assignment targets:
- Local variables.
- Parameters.
- Class properties.
static var.self.property.- Property chains.
- Array indexes.
- Dictionary indexes.
- PackedArray indexes and supported writable paths.
Compound assignment
Section titled “Compound assignment”func run_once() -> int: var local: int = 3 local += 4 total *= local total -= 2 return totalSupported operators:
+=-=*=/=%=**=<<=>>=&=^=|=
return
Section titled “return”func read_value() -> int: return 1
func maybe_value(flag: bool): if flag: return 1 returnSupported:
return expr- bare
return
Rules:
return exprmust be compatible with the return type.voidfunctions may only use barereturn.Variant-returning functions may use barereturn.- Concrete return types such as
int,float, and objects cannot use barereturn.
if / elif / else
Section titled “if / elif / else”func branch_value(value: int) -> int: if value > 0: return 100 elif value: return 10 else: return 1Supported:
if condition:elif condition:else:- Nested branches.
- Truthiness of non-
boolconditions.
func sum(limit: int) -> int: var index := 0 var total := 0 while index < limit: total += index index += 1 return totalSupported:
while condition:- Nested
while. breakinside the loop.continueinside the loop.
for / range
Section titled “for / range”func sum_values(values: Array[int]) -> int: var total := 0 for value in values: total += value return total
func count_down() -> void: for index in range(3, 0, -1): print(index)Supported:
for item in values:for index in range(stop),range(start, stop), andrange(start, stop, step).- Integer shorthand, such as
for index in 3:. - Iterating
String,Array,Dictionary(keys), and all PackedArrays. - Nested loops, plus
breakandcontinueinside loops. - Explicit iterator types, such as
for value: float in values:.
Limitations:
- The custom object
_iter_*iteration protocol is not supported. - Non-iterable types produce a type error.
func describe(value) -> String: match value: 0: return "zero" 1, 2: return "small" _: return "other"Supported:
- Literal patterns, wildcard
_, and bindingvar name. - Expression patterns.
- Array and dictionary patterns, including trailing
..rest. - Multiple patterns separated by commas.
whenguards.- Nested container patterns and nested bindings.
- Enum members as patterns.
breakandcontinueinside a section body apply to the enclosing loop.
Notes:
matchis a statement, not an expression.- Exhaustiveness is not required; if no section matches, execution continues after the
match. ..may only appear at the end of a pattern.- Dictionary patterns require key/value entries, such as
{"name": var value}; key-only{"name", "hp"}is not supported.
assert
Section titled “assert”func set_limit(limit: int) -> void: assert(limit > 0, "limit must be positive")Supported:
assert(condition).assert(condition, message).- Conditions follow truthiness rules.
- The message must be assignable to
String.
Notes:
- GDCC currently does not distinguish debug and release builds, so
assertalways remains. - A failure prints a runtime error and returns from the current function.
await and coroutines
Section titled “await and coroutines”signal finished(value: int)
func wait_for_finished() -> int: var value = await finished return int(value)
func run_job() -> int: var result = await compute_job() return result
func compute_job() -> int: await finished return 1Supported:
await signal: no parameters resume asnull, one parameter resumes as that value, and multiple parameters resume as anArray.awaiton instance or static coroutine calls.- Dynamic
await:Signal, GDCC coroutine state objects, and objects with acompletedsignal. awaitinside a lambda body.- A coroutine call used as a statement-root expression starts immediately without waiting for completion.
Limitations:
- A coroutine call used as an ordinary value must be written with
await; its result cannot be assigned, passed, returned, or stored in a container withoutawait. awaitis not supported in property initializers or parameter defaults.awaiton a statically known ordinary non-Signalvalue is an error.
Expressions
Section titled “Expressions”Literals
Section titled “Literals”var n: int = 1var f: float = 1.5var ok: bool = truevar missing: Object = nullvar text: String = "hello"var name: StringName = &"Player"var path: NodePath = ^"UI/Panel"Supported:
- Integer literals.
- Float literals.
true/false.null.- String literals.
StringNameliterals:&"name".NodePathliterals:^"path".- String escapes:
\",\n,\t,\\,\uXXXX,\UXXXXXXXX. - UTF-8 string contents.
- Array literals:
[1, 2, 3]. - Dictionary literals:
{"key": value}, plus the{key = value}StringName key form.
Identifiers and self
Section titled “Identifiers and self”Supported:
- Local variables.
- Parameters.
- Properties.
static var.- Signals.
- Singletons.
- Global enum members and global constants, such as
TYPE_NIL,OK,KEY_A. - GDScript language constants, such as
PI,TAU,INF,NAN. - Extreme-value constants, such as
INT32_MAX,INT64_MIN. - Type names.
- Inner class names.
- Enum members and enum group names.
self.super, only for super calls.
self restrictions:
- Available in instance functions.
- Not available in static functions.
- Do not depend on it in property initializers.
Property chains
Section titled “Property chains”func vector_y() -> float: var vector: Vector3 = Vector3(1.0, 2.0, 3.0) return vector.ySupported:
- Object property reads.
- Object property writes.
- Object method calls.
- Built-in value property reads, such as
Vector3.x,Color.a. - Built-in value property writes, such as
vector.x = 1.0. - Static constants, such as
Vector3.ZERO,Color.RED. - Static variables, such as
Counter.total. - Chained access, such as
Node.new().get_class().
Unsupported:
- Built-in property access using
vector["x"]. Usevector.x.
$Node and %UniqueName
Section titled “$Node and %UniqueName”func find_target() -> Node: var child: Node = $UI/Panel var unique: Node = %Player return childSupported:
$Child,$A/B,$"Path With Spaces"%UniqueName,%"Unique Name"NodePathliterals in the form^"path".$Nodeas a chain head, such as$UI/Panel.visible.
Limitations:
$/%may only be used in non-static function bodies of classes that inheritNode, and in recorded lambdas inside those bodies.$/%cannot be used in static functions or in classes that do not inheritNode.$/%cannot be used in property initializers or parameter defaults.- The static type of
$/%isNode; useaswhen a more specific type is needed.
Indexing
Section titled “Indexing”func compute(values: Array) -> int: values[1] = 6 var first: int = values[0] var second: int = values[1] return first * 10 + secondSupported:
Arrayreads and writes.Dictionaryreads and writes.- PackedArray reads and writes.
- Indexing in a property chain, such as
holder.values[0]. - Indexing in a static variable container, such as
Counter.labels[0]. - Typed array reads return the element type.
Notes:
- Key and index conversions are strict. Currently a
Dictionary[float, V]key acceptsint, and keys such asDictionary[Vector3, V]plus values such asDictionary[K, Vector3]accept same-dimension integer vectors. - When a dictionary key type is unclear, prefer putting a
Variantexplicitly.
func helper(value: int) -> int: return value + 1
func compute(seed: int) -> int: return helper(seed)Supported:
- Bare function calls.
- Instance method calls.
- Static method calls.
super.method(...)and baresuper(...).- Godot utility functions, such as
typeof(...),len(...),range(...). - GDScript language functions
char,ord,load,is_instance_of. - Engine method calls.
- Built-in method calls.
- Discarding a
voidcall result in statement position. - Some engine default-argument calls.
- Some engine vararg calls.
Variantdynamic call targets.- Some instance methods, static methods, utility functions, and lambdas as
Callable.
Callable limitations:
- GDScript language functions such as
lenandrangecan only be called directly, not referenced as values. - Constructors, built-in type static methods, and
Dictionaryinstance methods cannot be used directly asCallable.
Constructor calls
Section titled “Constructor calls”var vector: Vector3 = Vector3(1, 2.0, 3)var values: Array = Array()var table: Dictionary = Dictionary()var name: StringName = StringName("Player")var node: Node = Node.new()var worker: Worker = Worker.new()Supported:
- Bare built-in type construction.
int(value),String(value).Array(),Dictionary().- PackedArray construction, including from an
Array. - Engine class
.new(). - Zero-argument
.new()on GDCC custom classes. load(...)andpreload("res://...").
Unsupported:
- Parameterized
.new(...)on GDCC custom classes. - Constructing object types with a bare call, such as
Node().
load / preload
Section titled “load / preload”var scene: Resource = load("res://level.tscn")
func load_icon() -> Resource: return preload("res://icon.svg")Supported:
load(path).preload("path"), where the path must be a string literal.- Return values are treated as
Resource.
Notes:
- In GDCC,
preloadalso loads at runtime throughResourceLoader; it is not the interpreter’s compile-time preload. .gdscript resources are not loaded.- Paths are not normalized relative to the script at compile time.
- Path-based
preloadof another GDScript from the interpreter is still unsupported.
Lambdas
Section titled “Lambdas”signal pinged
func setup() -> void: pinged.connect(func() -> void: print("pinged"))
func make_adder(base: int) -> Callable: return func(value: int) -> int: return base + valueSupported:
- Lambda expressions inside function bodies, including
if,while,for,match, and ordinary blocks. - Nested lambdas.
- Explicit parameter types, and explicit or omitted return types.
- Capturing outer parameters, locals,
foriterators, outer lambda captures, andself. - Assigning a lambda to
var, aCallableparameter,Signal.connect, orCallable.call. awaitinside a lambda body.matchand$/%inside a lambda body.- Lambdas in
return func(): ...,foo(func(): ...), and container literal elements.
Limitations:
- Lambdas cannot appear in property initializers or parameter defaults.
- A lambda’s own parameter defaults are not supported.
- A bare
func(): ...statement in statement position is not supported. - Block-local
constinside a lambda is not supported.
Conditional expressions
Section titled “Conditional expressions”func pick(flag: bool) -> int: return 10 if flag else 20Supported:
value1 if condition else value2.- Nested conditional expressions, right-associative.
- Conditional expressions in statement position and condition position.
- Branch types merge according to type compatibility; if they cannot merge, the result is
Variant.
Limitations:
- One branch being
voidand the other a concrete type is not supported.
func find_node(value: Object) -> Node: return value as Node
func convert(value: Variant) -> int: return value as intSupported:
value as Type.- Built-in type conversion.
- Runtime type checks for engine objects and GDCC objects; a failed cast yields
null. - Casts to
Array[T]andDictionary[K, V]; at runtime only the base container is converted, and element type metadata is not added or rewritten. - Enum names as targets behave as
int.
Notes:
- Converting from
Variantor a dynamic value to a concrete type can fail at runtime. - Broad Godot runtime cast compatibility is incomplete; write an explicit
aswhen a conversion is uncertain.
is / is not
Section titled “is / is not”func check(value: Variant) -> bool: if value is Node and value is not Sprite2D: return true return falseSupported:
value is Type.value is not Type.- Built-in types, PackedArrays, bare
Array/Dictionary, typed containers, and engine objects. null is Variantistrue;null isany other type isfalse.- Runtime type metadata checks for
Array/Dictionary.
Limitations:
- Runtime
ischecks on dynamic script inheritance chains are incomplete. Statically determinable GDCC class relationships work; when uncertain, preferison engine types, or useasand then check for null.
Unary operators
Section titled “Unary operators”Supported:
not expr!expr+expr-expr~expr
Binary operators
Section titled “Binary operators”Supported:
| Group | Operators |
|---|---|
| logical short-circuit | and, &&, or, || |
| arithmetic | +, -, *, /, %, ** |
| bitwise | <<, >>, &, |, ^ |
| comparison | ==, !=, <, <=, >, >= |
| containment | in, not in |
| string formatting | String % value, %= |
Notes:
inandnot insupport existing containment relationships on arrays, dictionaries, strings, and similar values.%with a string left operand performs formatting, such as"%s=%d" % [name, hp].%with a numeric left operand remains modulo.- Named object subclasses as the right operand of string formatting, and
String % null, are currently unsupported.
Expression boundaries
Section titled “Expression boundaries”The following forms are still unsupported:
- Lambdas in property initializers.
$/%in property initializers and parameter defaults.- Built-in keyed access, such as
vector["x"]. - General compile-time constant evaluation.
Arrays, dictionaries, and PackedArrays
Section titled “Arrays, dictionaries, and PackedArrays”Array and dictionary literals
Section titled “Array and dictionary literals”func build_values() -> Array[int]: return [2, 4, 6]
func build_scores() -> Dictionary[StringName, int]: return {&"alpha": 2, &"beta": 5}Supported:
Array(),Dictionary().- Array literals
[...]. - Dictionary literals
{...}. - Literals in typed container contexts, such as
var values: Array[float] = [1, 2]. - Empty literals
[]and{}. - Nested untyped containers.
Notes:
- Literals do not infer a typed container from their elements;
var values := [1, 2]produces a plainArray. - Nested typed container annotations are still unsupported.
- Plain array literals are not automatically converted to PackedArrays.
Array and dictionary methods
Section titled “Array and dictionary methods”func summarize(values: Array) -> int: values.push_back(8) values.resize(4) return values.size()
func lookup(scores: Dictionary) -> bool: return scores.has("alpha")Supported:
- Common
Arraymethods such aspush_back,size, andresize. - Common
Dictionarymethods such assizeandhas. - Index reads and writes.
- Arrays and dictionaries use shared reference semantics; assignment does not copy their contents.
PackedArrays
Section titled “PackedArrays”func build() -> PackedInt32Array: var values: PackedInt32Array = PackedInt32Array([4, 5, 6]) var alias: PackedInt32Array = values alias.push_back(7) return valuesSupported:
- PackedArray construction, including empty construction and construction from an
Array. - Common method calls.
- Index reads and writes.
foriteration.
PackedArrays use reference semantics:
- Assigning to another variable shares the same data.
- Mutating through any alias is visible to the others.
+=creates a new array and rebinds the variable; old aliases are unaffected.duplicate()returns an independent copy.- A same-type
ascast produces a copy rather than sharing the original array.
Complete example
Section titled “Complete example”class_name Inventoryextends Node
signal item_added(name: StringName, amount: int)
enum Slot { WEAPON, ARMOR }
@export var capacity: int = 10
var totals: Dictionary[StringName, int] = {}
func add_item(name: StringName, amount: int = 1) -> void: var current: int = 0 if totals.has(name): current = totals[name] totals[name] = current + amount item_added.emit(name, amount)
func count_items(names: Array[StringName]) -> int: var total := 0 for name in names: if totals.has(name): total += totals[name] return total
func slot_name(slot: Slot) -> String: match slot: Slot.WEAPON: return "weapon" Slot.ARMOR: return "armor" _: return "unknown"
func setup() -> void: item_added.connect(func(name: StringName, amount: int) -> void: print(name, amount))Unsupported quick reference
Section titled “Unsupported quick reference”| Syntax | Status |
|---|---|
const X = 1 (class or local constant) | unsupported |
extends "res://base.gd" | unsupported |
| Interpreter path-based superclass, autoload superclass, cross-module superclass | unsupported |
| Attaching a GDCC script directly to a node | change to the corresponding node class |
Custom.new(arg), parameterized _init | unsupported |
| Lambda in a property initializer | unsupported |
| Lambda in a parameter default, lambda parameter defaults | unsupported |
Bare func(): ... in statement position | unsupported |
$ / % in property initializers or parameter defaults | unsupported |
vector["x"] | unsupported |
| Broad Godot runtime casts | incomplete; write an explicit as when needed |
Runtime is on dynamic script inheritance chains | incomplete |
| General compile-time constant evaluation | unsupported |
@onready ready-time semantics | not implemented |
@export / @onready on static var | unsupported |
enum inside a function | unsupported |
| Enum member values referencing parent enums, calling functions, or accessing properties | unsupported |
Array[Array[int]], Dictionary[String, Array[int]] | unsupported |
Custom object _iter_* iteration | unsupported |
super.property, super[index] | unsupported |
super(...) constructor calls, super._init(...) | unsupported |
await in property initializers or parameter defaults | unsupported |
Coroutine call used as an ordinary value without await | unsupported |
await on an ordinary non-Signal value | unsupported |
preload compile-time semantics, path-based preload of GDScript | unsupported |
static var setters/getters, automatic _static_init() | unsupported |
String % named object subclass, String % null | unsupported |