You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Properly report Callable bound arguments
Fixes #63213 Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
This commit is contained in:
@@ -87,6 +87,10 @@ const Callable *CallableCustomBind::get_base_comparator() const {
|
||||
return &callable;
|
||||
}
|
||||
|
||||
int CallableCustomBind::get_bound_arguments_count() const {
|
||||
return callable.get_bound_arguments_count() + binds.size();
|
||||
}
|
||||
|
||||
void CallableCustomBind::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
|
||||
const Variant **args = (const Variant **)alloca(sizeof(const Variant **) * (binds.size() + p_argcount));
|
||||
for (int i = 0; i < p_argcount; i++) {
|
||||
@@ -164,6 +168,10 @@ const Callable *CallableCustomUnbind::get_base_comparator() const {
|
||||
return &callable;
|
||||
}
|
||||
|
||||
int CallableCustomUnbind::get_bound_arguments_count() const {
|
||||
return callable.get_bound_arguments_count() - argcount;
|
||||
}
|
||||
|
||||
void CallableCustomUnbind::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
|
||||
if (argcount > p_argcount) {
|
||||
r_call_error.error = Callable::CallError::CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||
|
||||
Reference in New Issue
Block a user