-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typed Array constructor has no clear documentation about how it should be used #79066
Comments
You need to put the script as the fourth argument I think, see documentation |
That's not the script though, it's a class, try |
Try with |
Then no bug, though ambiguous as |
The docs are still not much clear about this. Should I close this and open a bug in godot-docs? or just leave this here? |
Leave here, the class reference is handled here |
Use Array(a, TYPE_OBJECT, &"RefCounted", MyClass) |
Already resolved above :) |
If/when #71336 is merged, this should become less verbose and confusing: Array[MyClass](a) |
Godot version
v4.0.3.stable.official [5222a99]
System information
Windows 10
Issue description
There is one (and only one, at least that is exposed to gdscript) array constructor meant to creating typed arrays. This constructor takes as first parameter a base array for copying it's elements from. But the way the constructor should be used could be better documented with examples for creating typed arrays from native types and custom types, and these could have examples for scripts with and without class_name and also for inner classes.
Steps to reproduce
Create a script with the code bellow and run it. It will yield the same error in any of the attempts to use the typed array. constructor. The correct usage has been clarified in the comments bellow but my struggle to find how to do it is at least an example of the poor experience other users could avoid if there where a couple of examples in the docs.
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: