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():

if current == "user://":
	names.1 = $TextEdit.text
elif current == "user://":
	names.2 = $TextEdit.text
elif current == "user://":
	names.3 = $TextEdit.text
elif current == "user://":
	names.4 = $TextEdit.text
elif current == "user://":
	names.5 = $TextEdit.text

‘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] = "..."