0 votes

I'm getting a parser error and I don't know how to fix it

onready var names = SaveFiles.names

onready var current = SaveFiles.current

func ondone_pressed():

SaveFiles.load_names()
if current == "user://save_1.save":
    names.1 = $TextEdit.text
elif current == "user://save_2.save":
    names.2 = $TextEdit.text
elif current == "user://save_3.save":
    names.3 = $TextEdit.text
elif current == "user://save_4.save":
    names.4 = $TextEdit.text
elif current == "user://save_5.save":
    names.5 = $TextEdit.text
SaveFiles.save_names()

'names' is a dictionary in an autoload and the names functions are for saving them but I think they are irrelivant.

the line with the error is 'names.1 = $TextEdit.text'

pls help

Godot version 3.44
in Engine by (24 points)

1 Answer

+1 vote
Best answer

I think those numeric dictonary keys are causing some confusion...

Try this syntax instead (for example):

names[1] = "..."

by (21,756 points)
selected by
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.