An error when connecting a signal with codes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Help me please

whenever i connect a signal in code the debugger alwaays show
The function 'connect()' returns a value, but this value is never used
is there any way to fix it out

:bust_in_silhouette: Reply From: wyattb

This is a warning. Your code still works. You can configure accordingly.

Thank you
But is there any way to fix it

Help me please | 2021-06-09 02:19

Check for the error. May save you some headache debugging down the line. E.g.

var err=turn_control.connect("turn_changed",self,"turn_changed")
if err:
	print("Error", err)

but if you don’t care then do something like this by adding an underscore

var _err=turn_control.connect("turn_changed",self,"turn_changed")

There is a 3rd way but only works one variable at a time:

#warning-ignore:UNUSED_VARIABLE
var err=turn_control.connect("turn_changed",self,"turn_changed")

wyattb | 2021-06-09 12:02

Thanks a lot

Help me please | 2021-06-10 04:34