The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

Accessing dictionary's key, which happens to be a digit

First of all, sorry if this has been asked, but I couldn't find anything, or maybe I just couldn't phrase it right.

I'm writing dialogue as of now, and I'm not quite sure how to call the keys, which are in integer form. I saw similar being used in the documentation, but no matter what way I've tried to call them, it failed.
"dictionary.22" fails, "dictionary.keys()[22]" fails etc. Trying to feed them in a string format, fails.

My question therefore is -- How do I access keys, that happen to be in numeric form?

Comments

  • cyberealitycybereality Posts: 1,053Moderator

    You can do this:

    d[22]
    
  • cyberealitycybereality Posts: 1,053Moderator

    Also, welcome to the forum!

  • Okai, I straight up need a facepalm award for that. Swear, I had tried that. =)
    Anyways, thanks for that. You managed to unclog my brains. XD
    And thanks for the welcome. Have a nice continuation of the day!

  • cyberealitycybereality Posts: 1,053Moderator

    Great news! So glad I could help. Please be sure to stick around the forums.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file