#Can't modify nested dictionary after assigning keys with iterations

9 messages · Page 1 of 1 (latest)

shut ledge
#

Where is player_class defined?

#

Maybe because dictionary is passed by reference, you need to do player_class[key] = hero_dict[key].duplicate(deep=true)?

#

Sorry, remove the deep=

#

I mean duplicate(true)

#

So player_class[key] = hero_dict[key].duplicate(true)

#

Oh I see, some hero_dict[key] values are dict and some are string

#

Can you remove the loop and do player_class = hero_dict.duplicate(true)? Or do you not want to copy the whole hero_dict

#

What do you mean?

#

Ah cool. I'm fairly new to Godot and hoping my years of Python knowledge transfer over