Where is the mistake? Saving Problem

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

I’m rewriting a storage system and ran into an interesting problem. There was an error where I did not change anything. Literally, a minute ago it started and even loaded values ​​- now an error has appeared.

func load_save() -> Dictionary:
var f := File.new()
f.open("res://slot.json", File.READ)
var result := JSON.parse(f.get_as_text())
f.close()
if result.error:
	printerr("Failed to parse save file: ", f.error_string)
return result.result as Dictionary

Error: Invalid get index ‘error_string’ (on base: ‘_File’).

I already rolled everything back, but it didn’t fix anything

Rewrite this again - and it works, lol

JerryHayat | 2020-04-26 16:55

:bust_in_silhouette: Reply From: jgodfrey

error_string is a property on a JSONParseResult object. You’re referencing it as if it’s a property on a File object.

I think you want result.error_string instead of f.error_string