Skip to content
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

Include in the documentation for Variant that only Objects can be null #10079

Closed
sockeye-d opened this issue Oct 13, 2024 · 0 comments · Fixed by #10093
Closed

Include in the documentation for Variant that only Objects can be null #10079

sockeye-d opened this issue Oct 13, 2024 · 0 comments · Fixed by #10093

Comments

@sockeye-d
Copy link

Your Godot version:
4.4dev3


Issue description:
The docs should contain some information that an untyped variable's value can be null, but a non-Object-typed statically typed variable cannot. Probably something along the lines of this:

An untyped variable can contain a null value, and variables that are statically typed with an Object-derived class can contain null, but variables containing primitive types (such as int, Array, and Vector3) cannot be null.

I think the main source of this confusion is a lack of documentation about where the type is stored (e.g. is the type something that only exists on variables, or is it an inherent property in the object/primitive?), so maybe that could get more clarification as well.

Also see this person's comment: godotengine/godot-proposals#162 (comment):

As a new Godot dev I find the current way things work in GDScript to be quite confusing. Some types are allowed to be null and can be checked i.e. if value: but others will produce errors. Nullable types could introduce some more clarity in regards to whether something should be null or not. null checking is very useful for things like custom resources! I hope so see this added soon.


URL to the documentation page (if already existing):
https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_basics.html#data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant