GDScript: Call static methods in native base class
This commit is contained in:
parent
897172fa25
commit
f3c2397e34
3 changed files with 25 additions and 2 deletions
|
|
@ -941,9 +941,19 @@ Variant GDScript::callp(const StringName &p_method, const Variant **p_args, int
|
|||
top = top->base.ptr();
|
||||
}
|
||||
|
||||
//none found, regular
|
||||
{
|
||||
Variant ret = Script::callp(p_method, p_args, p_argcount, r_error);
|
||||
if (r_error.error != Callable::CallError::CALL_ERROR_INVALID_METHOD) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return Script::callp(p_method, p_args, p_argcount, r_error);
|
||||
if (native.is_valid()) {
|
||||
return native->callp(p_method, p_args, p_argcount, r_error);
|
||||
}
|
||||
|
||||
r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD;
|
||||
return Variant();
|
||||
}
|
||||
|
||||
bool GDScript::_get(const StringName &p_name, Variant &r_ret) const {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
class_name TestCallNativeStatic
|
||||
extends JSON
|
||||
|
||||
func test():
|
||||
var s: GDScript = get_script()
|
||||
@warning_ignore("unsafe_method_access")
|
||||
print(s.stringify("test"))
|
||||
print(s.call(&"stringify", "test"))
|
||||
print(TestCallNativeStatic.stringify("test"))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
GDTEST_OK
|
||||
"test"
|
||||
"test"
|
||||
"test"
|
||||
Loading…
Add table
Add a link
Reference in a new issue