It could definitely be inferred as both a and b are typed. I suppose it could be hard or impossible to figure out its type with shadowing though, I dont know much about type inferencing. However I just found lerpf() that solves this
I was making game with Roblox before transitioning and sticking with Godot, Roblox has something which I like, and that is their built-in Terrain editor.
Is it possible that Godot can also implement this? I feel like it would be very useful.
I meant labeled breaks. For example, in C++ you can have
outer_loop:
while (check_a()) {
while (check_b()) {
...
if (foo > bar)
break outer_loop;
...
}
}
If you want to do something similar in GDScript, you need to add in extra variables to track your current depth and then repeat the break
statement.
Oh god, it felt so nice to use curly braces again.
Well to me.
I’m having hard time knowing what type variable is.
Everything is var
When i hover over it it’s just blank nothing.
I’m thinking to name variables not only a
var variableNames
But also
var variableNameType
Sometimes when i hover over known var with error it won’t say what it was
I have to ctrl click to know.
If you want static typing why not use:
var variableName : Type
Well even if I do that and hover over the variable it doesn’t say which variable type is
I need to ctrl click to go to it and move my eyes away from code and scroll back to the code it get’s tiresome.
so far
best workaround for me is:
var variableNameType = type()
only thing is I can but won’t rewrite whole GameEngine to that, … just cuz I’m forgetful and need to know what var type is sometimes.
That’s more a script editor limitation than GDScript’s, when using VSCode with the Godot Tools extension you get the hover tooltip showing types and documentation. I remember a proposal to add these tooltips to Godot’s built-in script editor though, don’t know when (or if) it will be ever implemented, sadly.
I’m stupid I misread the post.
maybe try catch statement
I wish when we document @export variables a description would show up in the editor. Frequently I need to refer to my code even though I attempt my variable names to be clear.
Thanks @soapspangledgames I am so happy this exists. I wish I knew about this when I started. Better late than never. In case anyone else is wondering, the double hash/pound key is how to get it to appear in the Inspector. ## this would appear in the inspector as a tooltip when you hover over the variable
Here is a link to the article in the docs, GDScript documentation comments — Godot Engine (stable) documentation in English
It would be nice to be able to declare classes inside of methods. Sometimes you just need to create a custom class that you will only use within a single method, and don’t want to add it as an inner class since you won’t be using it elsewhere. For example:
func calc_area()->void:
class LocalTriangle:
var a:Vector3
var b:Vector3
var c:Vector3
var temp_tri:LocalTriangle = LocalTriangle.new()
temp_tri.a = Vector3(1, 2, 3)
...
Being able to have multiple methods with the same name but which accept different parameter lists would also be really helpful. Eg:
func scan_tree(root:Node):
var info:MyInfo = create_info()
for child in root.get_children():
scan_tree(node, info)
func scan_tree(node:Node, info: MyInfo)->
...
for child in node.get_children():
scan_tree(node, info)
Typed Dictionaries are really missing, I could use them quite some time
Fortunately they are on the way, unclear what version but it’s well on the way to being integrated, follow the development here Implement typed dictionaries by Repiteo · Pull Request #78656 · godotengine/godot · GitHub
Awesome, I’m really looking forward to it <3
GDScript would also hugely benefit from being compiled in some way. I get so many strange errors from some magic in the engine failing to load resources or messing up class names. The same code can run fine in one place but then throw errors when used somewhere else, I suspect due to loading order issues.
Making GDScript statically typed and compiled and linked before running I feel would solve a lot of problems. It would also make it possible for GDScript to have circular references.
About the lack of typed dictionaries. With great respect to all contributors I just wonder why our community doesn’t see such issues as a priority (this super-important feature is still missing after the year of discussion, which started in Jun 2023). The lack of typed dictionaries is an abstraction leak at the language level, GDScript has incomplete type system (just yet, thanksfully). Godot is great and I am thankful to all contributors. But this was expressive fact and one of the main reasons why I choose Rust over GDScript and developing a GDExtension now. Hopefully for the best.