Topic was automatically imported from the old Question2Answer platform.
Asked By
JoaoCesar
Old Version
Published before Godot 3 was released.
When some_file.open and some_file.close are used, the info is immediately available to be used (synchronously?) in the same “tic”? In the attached image, will answers_dict always have some data in it?
When you read a file in GDScript, it happens synchronously, there are no threads involved on your side. You can use the data after it is read.
I don’t see where you set the singleton.questions_file variable, but I guess if you fill it with the results of read() before calling questions(), it will contain what you want.
Thank you a lot!!!
I really needed to know the exact behavior because I had a problem that only happened a few times so one of my thoughts was that probably singleton.read() was returning nothing from time to time.
And, yes, the singleton.questions_file is already set when I call singleton.read().