-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Dictionary element are not available by index #44241
Comments
I can confirm For info, as a workaround you can use the syntax |
I can confirm it too. |
hit this when looking up bone names in a dictionary. since I already made it, here is a reproduction project: run dictnames.tscn had some trouble with .get() ... I mean, it avoids a crash yes but produces the wrong result. I just worked around by iterating through all keys and checking equality. |
@lyuma I've checked your project and dictionary accesses with The only clunky thing I had to do is to use I'm not sure what the expected result from the scene is though. What wrong result did you get? |
so I have this example related to this issue (in GDScript):
I am not certain why is string literal converted to StringName in here instead of String |
The problem is likely related to Dictionary oh_lawd;
oh_lawd[StringName("chunky")] = "cat";
oh_lawd["chunky"] = "dog"; and end up with Dictionary of Current bool Variant::hash_compare(const Variant &p_variant) const {
if (type != p_variant.type) {
return false;
} and it bails in the first conditional check. |
looks as if this has hit a brick wall. Dictionary's might need an overhaul similar to what vnen is doing with Arrays. |
does anyone know if this is going to be fixed/addressed? I have to think that there are many people that are expecting Dictionaries to work as they did before. |
The |
Godot version:
custom d0f1c03
OS/device including version:
Windows 10
Issue description:
Cannot find existing key in Dictionary
Steps to reproduce:
Empty project
Create node
Add script
func _ready(): var dict: Dictionary = { "elem1": 1, "elem2": 2, } print(dict) print(dict["elem1"])
Output:
{elem1:1, elem2:2}
Debug:
Invalid get index 'elem1' (on base: 'Dictionary').
Minimal reproduction project:
bugreport.zip
The text was updated successfully, but these errors were encountered: