-
-
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
Update typed arrays documentation #79075
Conversation
</description> | ||
</method> | ||
<method name="get_typed_script" qualifiers="const"> | ||
<return type="Variant" /> | ||
<description> | ||
Returns the script associated with a typed array tied to a class name. | ||
Returns the script associated with the typed array. This method returns a [Script] instance or [code]null[/code]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it returns Object#null
, but I think it's a bug.
print(null) # <null>
print([].get_typed_script()) # <Object#null>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm not sure if this is a bug, this is the behavior of all Ref<T>
properties and method return values. Should we draw the reader's attention to this difference?
var sprite := Sprite2D.new()
print(sprite.texture) # <Object#null>
print(sprite.texture == null) # true
print(is_same(sprite.texture, null)) # false
print(typeof(sprite.texture)) # 24
print(typeof(null)) # 0
Returns the script associated with the typed array. This method returns a [Script] instance or [code]null[/code]. | |
Returns the script associated with the typed array. This method returns a [Script] instance (can be invalid). |
4985b75
to
b33c3fa
Compare
Also see #69451 in the eventuality that it will be taken a look at. |
Thanks! |
Cherry-picked for 4.2.2. |
get_typed_*()
methods.The constructor is verbose and a bit confusing, I've seen questions about it on Discord several times.