Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signals chapter contains stale redirect chain regarding Object::connect() #61

Open
axelmagn opened this issue Nov 29, 2024 · 1 comment
Labels
error Mistake in the book

Comments

@axelmagn
Copy link

Section in question:
https://godot-rust.github.io/book/register/signals.html?highlight=connect#registering-signals

Specific region:

As an alternative, you can use Godot's dynamic API to register signals. The Object class has methods connect() and emit_signal() that can be used to connect and emit signals, respectively.

While there are quite a few places in the docs that describe how to declare a new signal using #[signal], there does not seem to be anywhere that shows you how to connect a signal to a callable. The link in the above passage to Object::connect() API docs contains the following docstring:

To set the default parameters, use Self::connect_ex and its builder methods. See the book for detailed usage instructions.

This links to the section on functions, which demonstrates how to call a function via Object::call(). However this does not generalize to Object::connect(), which expects a Callable argument rather than the impl AsArg<StringName> expected by Object::call().

I would like to define a function in rust via #[func], then connect it via Object::connect() to a signal. Ideally the book, API docs, or both would include an example of how this could be achieved.

@axelmagn axelmagn added the error Mistake in the book label Nov 29, 2024
@axelmagn axelmagn changed the title Signals chapter contains circular redirect regarding Object::connect() Signals chapter contains stale redirect chain regarding Object::connect() Nov 29, 2024
@axelmagn
Copy link
Author

marked this as "error" primarily because I found the chain of redirects really confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error Mistake in the book
Projects
None yet
Development

No branches or pull requests

1 participant