Is possible to check a signal connection from a lambda function?

Godot Version

4.3.rc1

Question

I’m using some buttons to do some actions here and there, between the lines of code I make a connection to a signal followed by a lambda function that does some extra additional stuff. I’ve found myself spamming that button and having that signal multiplied. Before trying other workarounds, is there a way to check if this particular lambda signal connection exists before hand?
is_connnected() seems to expect a callable that does not exists in this situation. I could use get_connections(), but the lamba connections that appear here can be from other connections that may not be related.
Here is a snippet of the code:


	player.get_close_to(marker_closest_to_player(), item_configuration.item_id)
	## Check signal connection here?
	player.reached_item.connect(func(reached_item_id) -> void:
		if reached_item_id == item_configuration.item_id :
			ItemUseManager.create_new_slot_item(item_configuration)
1 Like

You could pass a flag to connect() that you could use to identify this function, but that’s a really hacky solution of course… But other than that I don’t think there’s a way.