@@ -307,6 +307,7 @@ impl Callable {
307
307
/// _Godot equivalent: `get_method`_
308
308
///
309
309
/// [godot#73052]: https://github.com/godotengine/godot/issues/73052
310
+ #[ doc( alias = "get_method" ) ]
310
311
pub fn method_name ( & self ) -> Option < StringName > {
311
312
let method_name = self . as_inner ( ) . get_method ( ) ;
312
313
if method_name. is_empty ( ) {
@@ -384,19 +385,28 @@ impl Callable {
384
385
self . as_inner ( ) . is_valid ( )
385
386
}
386
387
388
+ /// Returns a copy of the callable, ignoring `args` user arguments.
389
+ ///
390
+ /// Despite its name, this does **not** directly undo previous `bind()` calls. See
391
+ /// [Godot docs](https://docs.godotengine.org/en/latest/classes/class_callable.html#class-callable-method-unbind) for up-to-date semantics.
387
392
pub fn unbind ( & self , args : usize ) -> Callable {
388
393
self . as_inner ( ) . unbind ( args as i64 )
389
394
}
390
395
391
396
#[ cfg( since_api = "4.3" ) ]
392
- #[ doc( alias = "get_argument_count" ) ]
393
- pub fn arg_len ( & self ) -> usize {
397
+ pub fn get_argument_count ( & self ) -> usize {
394
398
self . as_inner ( ) . get_argument_count ( ) as usize
395
399
}
396
400
397
- #[ doc( alias = "get_bound_arguments_count" ) ]
398
- pub fn bound_args_len ( & self ) -> i64 {
399
- self . as_inner ( ) . get_bound_arguments_count ( )
401
+ /// Get number of bound arguments.
402
+ ///
403
+ /// Note: for Godot < 4.4, this function returns incorrect results when applied on a callable that used `unbind()`.
404
+ /// See [#98713](https://github.com/godotengine/godot/pull/98713) for details.
405
+ pub fn get_bound_arguments_count ( & self ) -> usize {
406
+ // This does NOT fix the bug before Godot 4.4, just cap it at zero. unbind() will still erroneously decrease the bound arguments count.
407
+ let alleged_count = self . as_inner ( ) . get_bound_arguments_count ( ) ;
408
+
409
+ alleged_count. max ( 0 ) as usize
400
410
}
401
411
402
412
#[ doc( hidden) ]
0 commit comments