Skip to content

GDScript Subset 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

Supported declared type families:

GroupTypes
dynamic / empty / no returnVariant, Nil, null, 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 arrays
objectsObject, engine classes, GDCC script classes, visible inner classes

Supported typed containers:

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

Supported type boundaries:

  • same type to same type.
  • any stable type to Variant.
  • stable Variant to a concrete target type.
  • object subclass to object superclass.
  • null to object types.
  • limited Array / Dictionary covariance.

Unsupported common conversions:

  • int -> float.
  • float -> int.
  • String -> StringName.
  • StringName -> String.
  • integer vectors to float vectors.
  • enum as a first-class typed boundary.

Supported:

class_name Player
extends Node
class Worker extends RefCounted:
var value: int
  • class_name Name.
  • class_name Name extends Base.
  • standalone top-level extends Base.
  • omitted class_name, with a class name derived from the file name.
  • omitted extends, defaulting to RefCounted.
  • inner classes with class Name: and class Name extends Base:.
  • nested inner classes.

Unsupported:

  • extends "res://base.gd".
  • autoload superclass binding.
  • cross-module superclass binding.
  • complex superclass expressions.

Supported:

@export var visible_payload: Variant
@onready var target: Node
  • @export on class properties.
  • @onready on non-static class properties whose owner class inherits Node.

Unsupported or not meaningful for compiled scripts:

  • @export_range(...).
  • function @rpc(...) behavior.
  • @warning_ignore(...) behavior.
  • runtime behavior of @tool and @icon.

Supported properties:

var score: int = 0
var payload: Variant
var values: Array[int]
var worker: Worker = Worker.new()

Supported signals:

signal changed(value: int)
signal ready()

Supported functions:

func add(a: int, b: int) -> int:
return a + b
static func build() -> Worker:
return Worker.new()
func _init() -> void:
pass

Unsupported or limited:

  • script static var.
  • class or local const.
  • property := as non-Variant metadata.
  • parameter defaults.
  • parameterized GDCC custom class .new(...).
  • using self inside static func.

Supported engine virtual overrides:

func _ready() -> void:
pass
func _process(delta: float) -> void:
pass
func _physics_process(delta: float) -> void:
pass

Virtual overrides must match parameter count, parameter types, return type, and instance/static shape.

Supported:

  • pass.
  • comments.
  • local var.
  • assignment.
  • compound assignment.
  • return and return expr.
  • if / elif / else.
  • while.
  • loop-local break and continue.
func sum(limit: int) -> int:
var index := 0
var total := 0
while index < limit:
if index == 3:
index += 1
continue
total += index
index += 1
return total

Supported compound assignment operators:

  • +=, -=, *=, /=, %=, **=.
  • <<=, >>=, &=, ^=, |=.

Unsupported:

  • for.
  • match.
  • assert.
  • await.
  • lambda bodies.
  • coroutine flow.

Supported literals:

  • integers.
  • floats.
  • true / false.
  • null.
  • strings, including common escapes and UTF-8 text.
  • StringName literals such as &"Player".

Supported expression forms:

  • identifiers.
  • self.
  • property chains.
  • subscript reads and writes.
  • bare calls.
  • method calls.
  • static calls.
  • utility calls.
  • constructors.
  • unary and binary operators.
  • parenthesized expressions.

Supported constructors:

var vector: Vector3 = Vector3(1.0, 2.0, 3.0)
var values: Array = Array()
var table: Dictionary = Dictionary()
var node: Node = Node.new()
var worker: Worker = Worker.new()

Supported unary operators:

  • not, !, unary +, unary -, ~.

Supported binary operators:

GroupOperators
logical short-circuitand, &&, or, `
arithmetic+, -, *, /, %, **
bitwise<<, >>, &, |, ^
comparison==, !=, <, <=, >, >=
containmentin

Unsupported expressions:

SyntaxAlternative
[1, 2, 3]Array() + push_back
{"a": 1}Dictionary() + assignment
a if cond else bif statements
preload(...)avoid
$Nodeavoid shorthand
value as Typeconstructors or typed boundaries
value is Typeavoid
lambdanormal function
await expravoid

Array style:

var values: Array = Array()
values.push_back(1)
values.push_back(2)

Dictionary style:

var scores: Dictionary = Dictionary()
scores["alpha"] = 2
scores["beta"] = 5

Packed array style:

var values: PackedInt32Array = PackedInt32Array()
values.push_back(4)
values.push_back(5)
return values[0] + values[1]
class_name InventoryCounter
extends Node
class Item extends RefCounted:
var amount: int
func set_amount(next: int) -> void:
amount = next
func read_amount() -> int:
return amount
var total: int = 0
func make_item(amount: int) -> Item:
var item: Item = Item.new()
item.set_amount(amount)
return item
func add_amounts(values: Array) -> int:
var index := 0
total = 0
while index < values.size():
var item: Item = make_item(int(values[index]))
total += item.read_amount()
index += 1
return total
SyntaxStatus
for item in values:unsupported
match value:unsupported
func f(a = 1):unsupported parameter default
assert(condition)unsupported
await signalunsupported
lambdaunsupported
const X = 1unsupported
static var x: intunsupported
[1, 2, 3]unsupported
{"a": 1}unsupported
a if cond else bunsupported
preload(...)unsupported
$Nodeunsupported
value as Typeunsupported
value is Typeunsupported
not inunsupported
extends "res://base.gd"unsupported
Custom.new(arg)unsupported for GDCC custom classes