0 votes

Hello there!
I have a save file system and I want to insert an index to a {} array for everytime I load a node.
Everything is going fine but the insert function only seems to work on [] arrays and not on {} arrays.

in Engine by (20 points)

Just so you know, something like:

x = {}

is called a Dictionary :)

1 Answer

+1 vote
Best answer

You can read about diciotnaries in in-editor documentation. Generally You add new elements like this :

var dict = {}
dict["index"] = 1

after this operation dict becomes :

dict = {"index" : 1 }

if entry already exists, its value will be changed. If entry doesn't exist, it will be created with following value

by (5,651 points)
selected by

So simple haha, that I ask God to bless you!

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 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 webmaster@godotengine.org with your username.