names of dictionary keys creating errors

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By stoodleyc

I’m trying to use a variable from my dictionary however I keep getting this error:
“error(7,43): Expected end of statement after expression, got ’ : ’ instead.”
line of code:$"VBoxContainer/save 1".text = names.user://save_1.save (in ready function)

I’m pretty sure it’s because of the “://” in my key “user://save_1.save” but I need it be like that because it relates to my save function. is there any way I can fix this without changing it?

:bust_in_silhouette: Reply From: jisuwudou

try like this.

var dic = {"s://dfdf":1}
print(dic["s://dfdf"])
:bust_in_silhouette: Reply From: Inces

This syntax is out of this world. Did You paste this code correctly ? :wink:

If names is Dictionary, You can refer to its key like this :

names[user://save_1.save]

thank you. I made the change although I’m still getting the error.

stoodleyc | 2022-09-22 00:16

I forgot “”

names["user://save_1.save"]

Inces | 2022-09-22 06:01