Skip to content

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 = 10
var dynamic_payload
func mix(value, count: int) -> Variant:
var local := count + 1
dynamic_payload = value
return local

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.
  • Variant assigned to a concrete target type.
  • Variant used as a dynamic call target.
  • A Variant return value assigned to an explicitly typed variable.

Supported declared type families:

GroupTypes
empty / dynamic / no returnNil, null, Variant, void, Void
scalarbool, int, float
string-likeString, StringName, NodePath
math and geometryVector2, Vector2i, Vector3, Vector3i, Vector4, Vector4i, Rect2, Rect2i, Transform2D, Transform3D, Plane, Quaternion, AABB, Basis, Projection, Color
handle and callableRID, Callable, Signal
containersArray, Dictionary
packed arraysPackedByteArray, PackedInt32Array, PackedInt64Array, PackedFloat32Array, PackedFloat64Array, PackedStringArray, PackedVector2Array, PackedVector3Array, PackedVector4Array, PackedColorArray
objectsObject, engine classes, GDCC script classes, visible inner classes

Array[T] and Dictionary[K, V] are supported.

var nodes: Array[Node]
var workers: Array[Worker]
var payloads: Dictionary[StringName, Node]

Supported rules:

  • Array is a plain dynamic array.
  • Dictionary is a plain dynamic dictionary.
  • T in Array[T] must be a resolvable leaf type.
  • K and V in Dictionary[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 Dictionary in value position and supports keys() and values().
  • A named enum can be used as a type annotation, such as var state: State or Array[State]; it behaves as int.
  • Cross-class access is supported, such as Other.State.IDLE and Other.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:

  • enum may 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.
SourceTargetStatus
same typesame typesupported
intfloatsupported
Vector2i / Vector3i / Vector4isame-dimension Vector2 / Vector3 / Vector4supported
StringStringNamesupported
StringNameStringsupported
any stable typeVariantsupported
Variantconcrete typesupported
object subclassobject superclasssupported
nullobject typesupported
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 = 1
var 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, and NodePath -> StringName.
  • Vector2 -> Vector2i, Vector3 -> Vector3i, and Vector4 -> Vector4i.
  • vector conversions with mismatched dimensions, such as Vector2i -> Vector3.
  • Rect2i -> Rect2 and Rect2 -> 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.

Each .gd file corresponds to one top-level script class.

class_name Player
extends Node
var hp: int = 100

Supported:

  • 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 to RefCounted.

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 and multi-level inner classes are supported.

class_name Outer
extends 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.

Script class static var is supported.

class_name Counter
extends RefCounted
static var total: int = 0
static var labels: Array[String] = []
static func add(amount: int) -> void:
total += amount

Supported:

  • 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.total or obj.total, operates on the declaring class’s shared storage; this form produces a warning.
  • A subclass accessing a parent static var shares the same storage.
  • static var in inner classes.
  • static var initializers that access other static members, global constants, singletons, and supported calls.

Limitations:

  • @export and @onready cannot be used on static var.
  • Static setters/getters are not supported.
  • _static_init() is not called automatically.

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 Army
extends 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.property and super[index] are not supported.
  • Explicit super(...) constructor calls and super._init(...) are not supported; GDCC automatically chains the parent _init.
  • Bare super(...) cannot be used inside a lambda; use super.method(...) there instead.
  • super cannot be used in static functions.
  • final or override-prevention semantics are not supported.

Script-level @tool, the @export family, and @onready are supported.

@tool
class_name EditorProbe
extends 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: Node

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; not static var.
  • Annotation arguments accept literals only, not constant names or expressions.
  • Each @export_* variant has property type requirements. For example, @export_range is for int/float, @export_file is for String, @export_color_no_alpha is for Color, and @export_node_path is for NodePath.
  • Bare @export supports built-in types, Resource, Node, and script enums. Exporting a Node-derived type requires the containing class to inherit Node.
  • When a property uses a named enum type, bare @export generates an enum dropdown in the editor.
  • Do not apply @export_* variants to container properties.
  • May only appear at the top of the script, before extends and class_name.
  • Accepts no arguments.
  • @tool propagates to the script’s top-level class and inner classes.
  • _process and _physics_process do not run in the editor for non-@tool classes; other callbacks still run. Runtime behavior is unaffected.
  • Only class properties declared with var.
  • Not static var.
  • The owner class must inherit Node.
var score: int = 0
var payload: Variant
var values: Array[int]
var worker: Worker = Worker.new()

Supported forms:

  • var name
  • var name = value
  • var name: Type
  • var name: Type = value
  • var name := value
  • @export var name: Type
  • @onready var name: Type
  • static var name: Type
  • static var name: Type = value

Notes:

  • Prefer explicit types for properties.
  • Properties without an explicit type are treated as Variant.
  • Property := currently also produces a Variant property.
  • 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 $Node or %UniqueName.
  • const is still unsupported.
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 Signal values, such as changed, self.changed, or obj.changed.
  • signal.emit(...), with any number of arguments.
  • signal.connect(callable), signal.connect(callable, flags), and signal.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; emit does not check argument count or types against the declared signature.
  • connect flags use qualified forms, such as Object.CONNECT_ONE_SHOT.
func add(a: int, b: int) -> int:
return a + b
static func build() -> Worker:
return Worker.new()
func _init() -> void:
pass

Supported 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 self and 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.
  • _init parameter defaults are not supported.
  • Lambda parameter defaults are not supported.

Unsupported or limited forms:

  • Parameterized .new(...) on GDCC custom classes.
  • Relying on a parameterized _init being called automatically by .new(...).

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:
pass

Important:

  • _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.
func noop() -> void:
pass

Supported:

  • pass
  • Ordinary comments.
func compute(seed: int) -> int:
var value: int = seed + 1
var dynamic_value = value
var inferred := value * 2
return inferred

Supported forms:

  • var name
  • var name = value
  • var name: Type
  • var name: Type = value
  • var name := value

Unsupported forms:

  • const local_value = 1
  • Declaring the same local name twice in the same scope.
func update(values: Array) -> void:
var local: int = 1
local = local + 1
values[0] = local
self.hp = local

Supported assignment targets:

  • Local variables.
  • Parameters.
  • Class properties.
  • static var.
  • self.property.
  • Property chains.
  • Array indexes.
  • Dictionary indexes.
  • PackedArray indexes and supported writable paths.
func run_once() -> int:
var local: int = 3
local += 4
total *= local
total -= 2
return total

Supported operators:

  • +=
  • -=
  • *=
  • /=
  • %=
  • **=
  • <<=
  • >>=
  • &=
  • ^=
  • |=
func read_value() -> int:
return 1
func maybe_value(flag: bool):
if flag:
return 1
return

Supported:

  • return expr
  • bare return

Rules:

  • return expr must be compatible with the return type.
  • void functions may only use bare return.
  • Variant-returning functions may use bare return.
  • Concrete return types such as int, float, and objects cannot use bare return.
func branch_value(value: int) -> int:
if value > 0:
return 100
elif value:
return 10
else:
return 1

Supported:

  • if condition:
  • elif condition:
  • else:
  • Nested branches.
  • Truthiness of non-bool conditions.
func sum(limit: int) -> int:
var index := 0
var total := 0
while index < limit:
total += index
index += 1
return total

Supported:

  • while condition:
  • Nested while.
  • break inside the loop.
  • continue inside the loop.
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), and range(start, stop, step).
  • Integer shorthand, such as for index in 3:.
  • Iterating String, Array, Dictionary (keys), and all PackedArrays.
  • Nested loops, plus break and continue inside 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 binding var name.
  • Expression patterns.
  • Array and dictionary patterns, including trailing .. rest.
  • Multiple patterns separated by commas.
  • when guards.
  • Nested container patterns and nested bindings.
  • Enum members as patterns.
  • break and continue inside a section body apply to the enclosing loop.

Notes:

  • match is 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.
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 assert always remains.
  • A failure prints a runtime error and returns from the current function.
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 1

Supported:

  • await signal: no parameters resume as null, one parameter resumes as that value, and multiple parameters resume as an Array.
  • await on instance or static coroutine calls.
  • Dynamic await: Signal, GDCC coroutine state objects, and objects with a completed signal.
  • await inside 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 without await.
  • await is not supported in property initializers or parameter defaults.
  • await on a statically known ordinary non-Signal value is an error.
var n: int = 1
var f: float = 1.5
var ok: bool = true
var missing: Object = null
var text: String = "hello"
var name: StringName = &"Player"
var path: NodePath = ^"UI/Panel"

Supported:

  • Integer literals.
  • Float literals.
  • true / false.
  • null.
  • String literals.
  • StringName literals: &"name".
  • NodePath literals: ^"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.

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.
func vector_y() -> float:
var vector: Vector3 = Vector3(1.0, 2.0, 3.0)
return vector.y

Supported:

  • 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"]. Use vector.x.
func find_target() -> Node:
var child: Node = $UI/Panel
var unique: Node = %Player
return child

Supported:

  • $Child, $A/B, $"Path With Spaces"
  • %UniqueName, %"Unique Name"
  • NodePath literals in the form ^"path".
  • $Node as a chain head, such as $UI/Panel.visible.

Limitations:

  • $ / % may only be used in non-static function bodies of classes that inherit Node, and in recorded lambdas inside those bodies.
  • $ / % cannot be used in static functions or in classes that do not inherit Node.
  • $ / % cannot be used in property initializers or parameter defaults.
  • The static type of $ / % is Node; use as when a more specific type is needed.
func compute(values: Array) -> int:
values[1] = 6
var first: int = values[0]
var second: int = values[1]
return first * 10 + second

Supported:

  • Array reads and writes.
  • Dictionary reads 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 accepts int, and keys such as Dictionary[Vector3, V] plus values such as Dictionary[K, Vector3] accept same-dimension integer vectors.
  • When a dictionary key type is unclear, prefer putting a Variant explicitly.
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 bare super(...).
  • 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 void call result in statement position.
  • Some engine default-argument calls.
  • Some engine vararg calls.
  • Variant dynamic call targets.
  • Some instance methods, static methods, utility functions, and lambdas as Callable.

Callable limitations:

  • GDScript language functions such as len and range can only be called directly, not referenced as values.
  • Constructors, built-in type static methods, and Dictionary instance methods cannot be used directly as Callable.
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(...) and preload("res://...").

Unsupported:

  • Parameterized .new(...) on GDCC custom classes.
  • Constructing object types with a bare call, such as Node().
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, preload also loads at runtime through ResourceLoader; it is not the interpreter’s compile-time preload.
  • .gd script resources are not loaded.
  • Paths are not normalized relative to the script at compile time.
  • Path-based preload of another GDScript from the interpreter is still unsupported.
signal pinged
func setup() -> void:
pinged.connect(func() -> void:
print("pinged"))
func make_adder(base: int) -> Callable:
return func(value: int) -> int:
return base + value

Supported:

  • 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, for iterators, outer lambda captures, and self.
  • Assigning a lambda to var, a Callable parameter, Signal.connect, or Callable.call.
  • await inside a lambda body.
  • match and $ / % 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 const inside a lambda is not supported.
func pick(flag: bool) -> int:
return 10 if flag else 20

Supported:

  • 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 void and 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 int

Supported:

  • 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] and Dictionary[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 Variant or a dynamic value to a concrete type can fail at runtime.
  • Broad Godot runtime cast compatibility is incomplete; write an explicit as when a conversion is uncertain.
func check(value: Variant) -> bool:
if value is Node and value is not Sprite2D:
return true
return false

Supported:

  • value is Type.
  • value is not Type.
  • Built-in types, PackedArrays, bare Array / Dictionary, typed containers, and engine objects.
  • null is Variant is true; null is any other type is false.
  • Runtime type metadata checks for Array / Dictionary.

Limitations:

  • Runtime is checks on dynamic script inheritance chains are incomplete. Statically determinable GDCC class relationships work; when uncertain, prefer is on engine types, or use as and then check for null.

Supported:

  • not expr
  • !expr
  • +expr
  • -expr
  • ~expr

Supported:

GroupOperators
logical short-circuitand, &&, or, ||
arithmetic+, -, *, /, %, **
bitwise<<, >>, &, |, ^
comparison==, !=, <, <=, >, >=
containmentin, not in
string formattingString % value, %=

Notes:

  • in and not in support 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.

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.
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 plain Array.
  • Nested typed container annotations are still unsupported.
  • Plain array literals are not automatically converted to PackedArrays.
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 Array methods such as push_back, size, and resize.
  • Common Dictionary methods such as size and has.
  • Index reads and writes.
  • Arrays and dictionaries use shared reference semantics; assignment does not copy their contents.
func build() -> PackedInt32Array:
var values: PackedInt32Array = PackedInt32Array([4, 5, 6])
var alias: PackedInt32Array = values
alias.push_back(7)
return values

Supported:

  • PackedArray construction, including empty construction and construction from an Array.
  • Common method calls.
  • Index reads and writes.
  • for iteration.

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 as cast produces a copy rather than sharing the original array.
class_name Inventory
extends 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))
SyntaxStatus
const X = 1 (class or local constant)unsupported
extends "res://base.gd"unsupported
Interpreter path-based superclass, autoload superclass, cross-module superclassunsupported
Attaching a GDCC script directly to a nodechange to the corresponding node class
Custom.new(arg), parameterized _initunsupported
Lambda in a property initializerunsupported
Lambda in a parameter default, lambda parameter defaultsunsupported
Bare func(): ... in statement positionunsupported
$ / % in property initializers or parameter defaultsunsupported
vector["x"]unsupported
Broad Godot runtime castsincomplete; write an explicit as when needed
Runtime is on dynamic script inheritance chainsincomplete
General compile-time constant evaluationunsupported
@onready ready-time semanticsnot implemented
@export / @onready on static varunsupported
enum inside a functionunsupported
Enum member values referencing parent enums, calling functions, or accessing propertiesunsupported
Array[Array[int]], Dictionary[String, Array[int]]unsupported
Custom object _iter_* iterationunsupported
super.property, super[index]unsupported
super(...) constructor calls, super._init(...)unsupported
await in property initializers or parameter defaultsunsupported
Coroutine call used as an ordinary value without awaitunsupported
await on an ordinary non-Signal valueunsupported
preload compile-time semantics, path-based preload of GDScriptunsupported
static var setters/getters, automatic _static_init()unsupported
String % named object subclass, String % nullunsupported