-
-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Issue: When registering a named bound anonymous function like referenced below godot will throw an error:
E 0:00:00:729 util.gd:34 @ get_method_info(): Can't get method on CallableCustom "Delegate::Invoke".
<C++ Error> Method/function failed. Returning: StringName()
<C++ Source> core/variant/callable.cpp:454 @ get_method()
util.gd:34 @ get_method_info()
limbo_console.gd:978 @ _validate_callable()
limbo_console.gd:284 @ register_command()
which links to here on the godot repo: https://github.com/godotengine/godot/blob/49a5bc7b616bd04689a2c89e89bda41f50241464/core/variant/callable.cpp#L454
I researched any work-arounds I could find:
- use string interpolation like so
print("%s" % [p_callable])the resulting string will be something like<class>(script)::<anonymous_func_name>and if the callable is a custom callable we can get their method name from there and trim everything until the ::? - Reduce the amount of errors being thrown by altering the loop in util.gd get_method_info to only call
p_callable.get_method()once instead of every time in the loop - Wait until there is a fix on the following issue Can't get method on CallableCustom "Delegate::Invoke" error when using a lambda function in UndoRedo.AddDoMethod and UndoRedo.AddUndoMethod godotengine/godot#90430
Luckily functionally the plug-in works as expected still its just an annoyance for errors when registering and running commands
Unfortunately after reviewing the bug in depth more it seems to be related to:
The closest I can get to getting the callables name without the error throwing is by using the following:
which was registered as such:
func _ready() -> void: LimboConsole.register_command(multiply.bind(52).bind(3), "m4") func multiply(a: float, b: float) -> void: LimboConsole.info("a * b: " + str(a * b))I'm not certain we want to code for this explicitly and maybe just wait for the godot issue linked above to be fixed. Perhaps we should open a separate issue to track this?
Originally posted by @RcubDev in #59
