Merge pull request #31172 from creikey/add-array-slicing
Add array slice method
This commit is contained in:
commit
2114898cb5
7 changed files with 101 additions and 0 deletions
|
|
@ -327,6 +327,15 @@ godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_b
|
|||
return res;
|
||||
}
|
||||
|
||||
godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep) {
|
||||
const Array *self = (const Array *)p_self;
|
||||
godot_array res;
|
||||
Array *val = (Array *)&res;
|
||||
memnew_placement(val, Array);
|
||||
*val = self->slice(p_begin, p_end, p_step, p_deep);
|
||||
return res;
|
||||
}
|
||||
|
||||
godot_variant GDAPI godot_array_max(const godot_array *p_self) {
|
||||
const Array *self = (const Array *)p_self;
|
||||
godot_variant v;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,17 @@
|
|||
["const godot_vector2 *", "p_self"],
|
||||
["const godot_vector2 *", "p_to"]
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "godot_array_slice",
|
||||
"return_type": "godot_array",
|
||||
"arguments": [
|
||||
["const godot_array *", "p_self"],
|
||||
["const godot_int", "p_begin"],
|
||||
["const godot_int", "p_end"],
|
||||
["const godot_int", "p_step"],
|
||||
["const godot_bool", "p_deep"]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ void GDAPI godot_array_destroy(godot_array *p_self);
|
|||
|
||||
godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep);
|
||||
|
||||
godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_delta, const godot_bool p_deep);
|
||||
|
||||
godot_variant GDAPI godot_array_max(const godot_array *p_self);
|
||||
|
||||
godot_variant GDAPI godot_array_min(const godot_array *p_self);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue