Skip to content

DynGd can't be nullable in exported Array #1147

@Gaspard--

Description

@Gaspard--

Hello !

I noticed that Array<Option<DynGd<...>>> doesn't work, which seems like a missed edge case.

The following are accepted (T and U are placeholders for real types):

#[export]
x: Array<Gd<T>>,

#[export]
y: Array<Option<Gd<T>>>,

#[export]
z: Array<DynGd<T, U>>,

x is a little cubbersome because godot allows array elements to be unset, which is why y is useful in those scenarios.
z will fail with a message when an unset element is present, however we can't do the following:

#[export]
w: Array<Option<DynGd<T, U>>>,

error[E0277]: Array<T> can only store element types supported in Godot arrays (no nesting).

Obviously this is really minor, but looks like an oversight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: coreCore componentsquality-of-lifeNo new functionality, but improves ergonomics/internals

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions