+1 vote

I am curious to know what does the function open() in File returns. I know it is an integer, but of what? My guess is for error checking, but then, why not return Error instead?

in Engine by (60 points)

1 Answer

+1 vote
Best answer

Should be an Error which is an enumerated type. You can see in the code below it will return parameters invalid, can't open file, and OK.

https://github.com/godotengine/godot/blob/df61dc4b2bd54a5a40c515493c76f5a458e5b541/drivers/windows/file_access_windows.cpp#L56

The enum can be seen here:

https://github.com/godotengine/godot/blob/df61dc4b2bd54a5a40c515493c76f5a458e5b541/core/error_list.h#L40

by (5,232 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.