godot-cpp
godot-cpp copied to clipboard
[GDExtension] Allow having generic classes as array-like in gdscript
In GDScript, when you make custom classes with gdext generally this is the way:
var myExtClass:CustomClass = CustomClass.new()
but what if I want to have an array-like class with generics? its currently possible? Something like:
var test:CustomClass[float] = []
this means that in cpp the customclass is:
class CustomClass<T> : public RefCounted {...};
where T is really T or it could be Variant or Object to support other custom classes
This goes way beyond this repo BTW, it would need magic on the Godot side to make it work, besides something in GDScript to recognize this pattern. This is something you can't do even within Godot itself.
Edit: you should open a proposal if you really want to go this path.