Storing vars in file as human readable plaintext?

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

Is it possible to make Godot save vars in a file as human readable?

		var file = File.new()
		file.open("./thisfile.txt", File.WRITE)
		file.store_var(position) #Unreadable
		file.store_string(str(position))
		file.close()

If I open the created file with notepad or whatever, the first store creates unreadable text. This also happens with store of numeric types, such as float and double.

Is there a way to make it so that Godot saves the vars, or anything that isn’t a string, as plaintext that can be edited manually later?

You can try using the JSON. If these are configuration files, you can also try the ConfigFile class.

Ertain | 2021-10-13 05:56

:bust_in_silhouette: Reply From: Inces

I don’t know about those methods of File class, and I don’t know how to convert JSON into easily readable file, but I know how to transform variables into strings :
You should use str2var() and var2str() methods

Or if You meant You need all your variables names :
get_script_property_list()

It is called on script class, I hope it helps