Document Object.connect() not supporting persistent connections with lambda functions#112487
Conversation
Calinou
commented
Nov 6, 2025
- See classes/class_object godot-docs-user-notes#293 (comment).
doc/classes/Object.xml
Outdated
| </constant> | ||
| <constant name="CONNECT_PERSIST" value="2" enum="ConnectFlags"> | ||
| Persisting connections are stored when the object is serialized (such as when using [method PackedScene.pack]). In the editor, connections created through the Node dock are always persisting. | ||
| [b]Note:[/b] Connections to lambda functions (i.e. when the function code is embedded in the [method connect] call) cannot be made persistent. |
There was a problem hiding this comment.
Okay so, this ambiguity is why I personally adamantly avoid both "e.g." and "i.e.": Because of what "i.e." literally stands for, this note strongly implies that "lambda" functions are when code is embedded in connect(), and that's really the only exception to CONNECT_PERSIST.
We know both statements aren't true, or at least it's quite misleading, so no point explaining it. However, I must note that we're working with "Callables" here, not just "functions".
In fact, what could be worth testing for this purpose is one fire-sure way to determine whether a Callable is a lambda or not.
No suggestion yet, it's late at night.
There was a problem hiding this comment.
And maybe you can add this description on the connections page?
831f645 to
1d0e988
Compare
…h lambda functions
1d0e988 to
475e792
Compare
|
Thanks! |