mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
Add recursive comparison to Array and Dictionary
...and expose it to GDScript. Co-authored-by: Emmanuel Leblond <emmanuel.leblond@gmail.com>
This commit is contained in:
parent
1f8497d281
commit
a7aad78fd0
11 changed files with 118 additions and 1 deletions
|
@ -134,6 +134,7 @@ const char *GDScriptFunctions::get_func_name(Function p_func) {
|
|||
"instance_from_id",
|
||||
"len",
|
||||
"is_instance_valid",
|
||||
"deep_equal",
|
||||
};
|
||||
|
||||
return _names[p_func];
|
||||
|
@ -1386,6 +1387,10 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
|
|||
}
|
||||
|
||||
} break;
|
||||
case DEEP_EQUAL: {
|
||||
VALIDATE_ARG_COUNT(2);
|
||||
r_ret = p_args[0]->deep_equal(*p_args[1]);
|
||||
} break;
|
||||
case FUNC_MAX: {
|
||||
ERR_FAIL();
|
||||
} break;
|
||||
|
@ -1955,6 +1960,11 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
|
|||
mi.return_val.type = Variant::BOOL;
|
||||
return mi;
|
||||
} break;
|
||||
case DEEP_EQUAL: {
|
||||
MethodInfo mi("deep_equal", PropertyInfo(Variant::NIL, "a"), PropertyInfo(Variant::NIL, "b"));
|
||||
mi.return_val.type = Variant::BOOL;
|
||||
return mi;
|
||||
} break;
|
||||
default: {
|
||||
ERR_FAIL_V(MethodInfo());
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue