CustomCallable
Builds a Godot Callable backed by a Scala closure (a custom callable), via the GDExtension callable_custom_create2 interface. This lets game code connect a signal to a lambda directly — no registered @func method and no string method name.
How the closure survives the FFI boundary: Scala Native CFuncPtrs must be non-capturing, so the trampolines below are static and the closure lives in a registry keyed by a generated id. That id is what we hand Godot as the opaque callable_userdata pointer (packed via Tokens, exactly like the class/instance tokens — the GC never chases a fabricated pointer because the closure is kept alive by the registry, not the pointer). Each trampoline reads the id back to find its closure; free_func drops the registry entry when Godot frees the Callable, so the closure is reachable for exactly as long as the engine holds it.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CustomCallable.type