+1 vote

If I have like the player name, level, experience should I store it in a list or dictionary. Like ['Bob', 5, 87] or {'player name' : 'Bob', 'level' : 5, 'experience' : 87}. Which one is better?

in Engine by (455 points)

1 Answer

0 votes
Best answer

Of course, it always depends on the situation, but in general (at least for the way it sounds like you'll be using it), a Dictionary would be the best option here. This way you can put the values in properties that have names that make sense, and you don't have to remember or care about the order that you add or retrieve values.

by (1,663 points)
selected by

Thanks, I will try it. Using lists are not really working for me.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.