You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user