parser error: Expected end of statement after expression, got constant instead.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By stoodleyc

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 _on_done_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

:bust_in_silhouette: Reply From: jgodfrey

I think those numeric dictonary keys are causing some confusion…

Try this syntax instead (for example):

names[1] = "..."