0 votes

I am re-adding this question to help anyone finding the same issue, because my original question that I found this, had a mislead title. Why? Because I couldn't find anything to help me with this specific problem.

If you set a dictionary like:

var TITLE = loadedDate[0][2]#Just a example of a array stored with the Title

Library[TITLE_CATEGORY] = TITLE
Library[TITLE_CATEGORY][TITLE] = "Subtitle"

It will return a error like:

Invalid set index 'TITLE' (on base: 'String') with value of type 'String'.

in Engine by (332 points)

1 Answer

0 votes
Best answer

Because TITLE was set only as a string, the loadedDate[0][2] is just a string. So it was trying to add a dictionary subkey to a string,

The correct way of doing it is to keep it a dictionary if you want to add sub-keys:

Library[TITLE_CATEGORY] = {TITLE:"Subtitle"}

Now TITLE is a dictionary and can be referenced properly:

Library[TITLE_CATEGORY][TITLE]
by (332 points)
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.

Categories