Merge pull request #80506 from sepTN/fix-lambda-get_method
Fix `get_method` from named lambda
This commit is contained in:
commit
e1bb9b523d
|
@ -138,7 +138,7 @@
|
|||
<method name="get_method" qualifiers="const">
|
||||
<return type="StringName" />
|
||||
<description>
|
||||
Returns the name of the method represented by this [Callable]. If the callable is a lambda function, returns the function's name.
|
||||
Returns the name of the method represented by this [Callable]. If the callable is a GDScript lambda function, returns the function's name or [code]"<anonymous lambda>"[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_object" qualifiers="const">
|
||||
|
|
|
@ -67,6 +67,10 @@ ObjectID GDScriptLambdaCallable::get_object() const {
|
|||
return script->get_instance_id();
|
||||
}
|
||||
|
||||
StringName GDScriptLambdaCallable::get_method() const {
|
||||
return function->get_name();
|
||||
}
|
||||
|
||||
void GDScriptLambdaCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
|
||||
int captures_amount = captures.size();
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
CompareEqualFunc get_compare_equal_func() const override;
|
||||
CompareLessFunc get_compare_less_func() const override;
|
||||
ObjectID get_object() const override;
|
||||
StringName get_method() const override;
|
||||
void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
||||
|
||||
GDScriptLambdaCallable(Ref<GDScript> p_script, GDScriptFunction *p_function, const Vector<Variant> &p_captures);
|
||||
|
|
|
@ -63,6 +63,10 @@ ObjectID GDScriptRPCCallable::get_object() const {
|
|||
return object->get_instance_id();
|
||||
}
|
||||
|
||||
StringName GDScriptRPCCallable::get_method() const {
|
||||
return method;
|
||||
}
|
||||
|
||||
void GDScriptRPCCallable::call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const {
|
||||
r_return_value = object->callp(method, p_arguments, p_argcount, r_call_error);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
CompareEqualFunc get_compare_equal_func() const override;
|
||||
CompareLessFunc get_compare_less_func() const override;
|
||||
ObjectID get_object() const override;
|
||||
StringName get_method() const override;
|
||||
void call(const Variant **p_arguments, int p_argcount, Variant &r_return_value, Callable::CallError &r_call_error) const override;
|
||||
Error rpc(int p_peer_id, const Variant **p_arguments, int p_argcount, Callable::CallError &r_call_error) const override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue