You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when you print an enum (either just via print or Console.print_line) it prints the number that enum is, I think it'd be quite valuable to be able to make it automatically turn it back into the string type of the enum.
The method you need in godot 4.3 to get an enums string value is as follows
enum test {
test1,
test2,
test3,
test4
}
func get_test1():
var variable = test.test1
var variable_as_string = test.keys()[variable]
Sadly it dosen't seem possible to find the enum based upon the enum value, which we'd need to actually do this, I'm creating this issue in case there is a way to do so but I fear it isn't :/
The text was updated successfully, but these errors were encountered:
I did some tests, and it seems the type passed into a function when using an enum is considered to be an int, so there's no way to tell it's even an enum, let alone which enum in order to look up the name. I think you'll have to convert the enum to a name prior to calling the console print. You might be able to make a helper function like "Console.print_line(get_test_enum_name(test.test1))", but I don't think there's much that can be done beyond that.
Currently when you print an enum (either just via print or Console.print_line) it prints the number that enum is, I think it'd be quite valuable to be able to make it automatically turn it back into the string type of the enum.
The method you need in godot 4.3 to get an enums string value is as follows
Sadly it dosen't seem possible to find the enum based upon the enum value, which we'd need to actually do this, I'm creating this issue in case there is a way to do so but I fear it isn't :/
The text was updated successfully, but these errors were encountered: