summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_lambda_callable.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-07-05 15:07:47 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-07-05 15:07:47 +0200
commit33f456ccfed4f572d18645d58aa33730a7e5117d (patch)
treebc129fac5ef8a02efd70929f38f323bb6cf21009 /modules/gdscript/gdscript_lambda_callable.cpp
parent1704af01b15f16d0566075f1a525cad1829f8fbf (diff)
parentaa28782be391902e55131524f8d242b70888eb2c (diff)
downloadredot-engine-33f456ccfed4f572d18645d58aa33730a7e5117d.tar.gz
Merge pull request #93964 from AThousandShips/lambda_arg_fix
[GDScript] Fix `get_argument_count` for lambda `Callable`s
Diffstat (limited to 'modules/gdscript/gdscript_lambda_callable.cpp')
-rw-r--r--modules/gdscript/gdscript_lambda_callable.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/gdscript/gdscript_lambda_callable.cpp b/modules/gdscript/gdscript_lambda_callable.cpp
index 626ef6ccb0..42b0b066e1 100644
--- a/modules/gdscript/gdscript_lambda_callable.cpp
+++ b/modules/gdscript/gdscript_lambda_callable.cpp
@@ -84,7 +84,7 @@ int GDScriptLambdaCallable::get_argument_count(bool &r_is_valid) const {
return 0;
}
r_is_valid = true;
- return function->get_argument_count();
+ return function->get_argument_count() - captures.size();
}
void GDScriptLambdaCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
@@ -204,7 +204,7 @@ int GDScriptLambdaSelfCallable::get_argument_count(bool &r_is_valid) const {
return 0;
}
r_is_valid = true;
- return function->get_argument_count();
+ return function->get_argument_count() - captures.size();
}
void GDScriptLambdaSelfCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {