Hey all, I'm working on a small project and using static typing. I have a line where I am opening a file. The thing is, the open()
function returns the type Error, so I tried to type my variable in that way, but Godot doesn't let me do it and makes me type it as an int. See the line below:
What I want to do: var file_status: Error = dialogue_file.open(dialogue_path, File.READ)
What Godot makes me do: var file_status: int = dialogue_file.open(dialogue_path, File.READ)
Now I do know that technically Enums are ints, so I understand why int is an acceptable type here, but I feel like it would be more readable if I could properly type as Error.
Comparing some int to OK
just doesn't feel as readable to me without the knowledge that OK
is an enum and actually just returns an int.
var file_status: int = dialogue_file.open(dialogue_path, File.READ)
if file_status == OK:
. . .
Is there a way to type my variable as an enum, or am I just stuck typing it as int for now?