1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[Core] Add iteration support to Array

This commit is contained in:
A Thousand Ships
2023-12-24 13:44:21 +01:00
parent 1f0f81049f
commit 64146cb7f3
15 changed files with 251 additions and 73 deletions

View File

@@ -2012,12 +2012,14 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
p_recursion_count++;
p_store_string_func(p_store_string_ud, "[");
int len = array.size();
for (int i = 0; i < len; i++) {
if (i > 0) {
bool first = true;
for (const Variant &var : array) {
if (first) {
first = false;
} else {
p_store_string_func(p_store_string_ud, ", ");
}
write(array[i], p_store_string_func, p_store_string_ud, p_encode_res_func, p_encode_res_ud, p_recursion_count);
write(var, p_store_string_func, p_store_string_ud, p_encode_res_func, p_encode_res_ud, p_recursion_count);
}
p_store_string_func(p_store_string_ud, "]");