MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / resize

Method resize

core/variant/array.cpp:310–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310Error Array::resize(int p_new_size) {
311 ERR_FAIL_COND_V_MSG(_p->read_only, ERR_LOCKED, "Array is in read-only state.");
312 Variant::Type &variant_type = _p->typed.type;
313 int old_size = _p->array.size();
314 Error err = _p->array.resize_initialized(p_new_size);
315 if (!err && variant_type != Variant::NIL && variant_type != Variant::OBJECT) {
316 Variant *write = _p->array.ptrw();
317 for (int i = old_size; i < p_new_size; i++) {
318 VariantInternal::initialize(&write[i], variant_type);
319 }
320 }
321 return err;
322}
323
324Error Array::insert(int p_pos, const Variant &p_value) {
325 ERR_FAIL_COND_V_MSG(_p->read_only, ERR_LOCKED, "Array is in read-only state.");

Callers 15

constructMethod · 0.45
validated_constructMethod · 0.45
ptr_constructMethod · 0.45
constructMethod · 0.45
validated_constructMethod · 0.45
ptr_constructMethod · 0.45
convertMethod · 0.45
encodeMethod · 0.45
convertMethod · 0.45
encodeMethod · 0.45
convertMethod · 0.45
encodeMethod · 0.45

Calls 4

initializeFunction · 0.85
sizeMethod · 0.65
resize_initializedMethod · 0.45
ptrwMethod · 0.45

Tested by

no test coverage detected