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
Creating a signal that uses enum from some other class (SubNode in this case) works weirdly. My expectation is that you should use the full path of the enum, in this case SubNode.Foo:
Parse Error: Expected closing ")" after signal parameters.
However, if only the enum name without class is given, signal definition works:
signalsignal_using_enum_from_another_class2(Foo)
Using enum from the same class also works.
I didn't test what happens if multiple classes have an enum with same name.
Steps to reproduce
subnode.gd:
class_nameSubNodeextendsNode2DenumFoo {BAR}
main.gd
extendsNode2DenumMyEnum {ZAP}
signalsignal_using_my_enum(MyEnum)
vara: SubNode.Foosignalsignal_using_enum_from_another_class1(SubNode.Foo) # <---- errorsignalsignal_using_enum_from_another_class2(Foo) # <---- for some reason this works
Interesting, I have succesfully used signals with only types, or so have I though.
GDScript is not C++, you can't use pure signatures, parameter names are mandatory. The closest we can get is prefixing unused parameters with underscores. Maybe someday we'll support something like:
functest(_: String, _: Array= []) ->void
But I don't think we'll be able to omit parameter names entirely, especially since static typing is optional.
Tested versions
System information
Godot v4.4.dev3.mono - Windows 10.0.19045 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz (4 threads)
Issue description
Creating a signal that uses enum from some other class (
SubNode
in this case) works weirdly. My expectation is that you should use the full path of the enum, in this caseSubNode.Foo
:But you get an error message:
However, if only the enum name without class is given, signal definition works:
Using enum from the same class also works.
I didn't test what happens if multiple classes have an enum with same name.
Steps to reproduce
subnode.gd:
main.gd
Minimal reproduction project (MRP)
signal_enum_test.zip
The text was updated successfully, but these errors were encountered: