Hi all,
I have JSON data in a dictionary called dict
. I want to draw characters by calling the below fuction with something like drawCharacter(4)
.
func drawCharacter(id):
get_node("LabelCharacterName").set_text(dict["4"]["name"])
The problem is I can't do the above as if I try and use id
in the string like below:
func drawCharacter(id):
get_node("LabelCharacterName").set_text(dict[id]["name"])
... it doesn't work and returns an error that it's an invalid index.
I can ONLY get it to work if it's wrapped in " like in the first example.
How can I make this work? I'm currently stuck. Any help very much appreciated...