Class reference
Struct
A schema-backed container of named, typed fields with value semantics.
Description
Struct is a fixed-layout container whose fields are described by a shared schema (name, type, and optional default per field). Unlike Dictionary, a struct has value semantics: copying a struct copies its field values, and two structs compare equal when they share the same field layout and all field values are equal. Fields are accessed by name (a StringName or String) or by integer index through the [] operator. Values assigned to a field are validated against the schema and coerced to the field's declared type; incompatible values are rejected. Note: The schema itself is created and managed internally; structs are typically obtained from typed APIs or from GDScript struct declarations rather than constructed field-by-field from script.
Constructors
Operators
bool operator !=(Struct right)
bool operator !=(Struct right)Returns true if the two structs are not equal, that is, if they have a different field layout or any field value differs.
bool operator ==(Struct right)
bool operator ==(Struct right)Returns true if the two structs are equal. Structs are equal when they share the same field layout and all corresponding field values compare equal; structs with different layouts are never equal.
Variant operator [](Variant key)
Variant operator [](Variant key)Accesses a struct field. The key may be the field name (a StringName or String) or the integer field index. Assignment is validated against the struct's schema: incompatible values are rejected, and accepted values are coerced to the field's declared type.