Array+=: Difference between revisions

From Bohemia Interactive Community
(Fix description)
m (Text replacement - "\[\[Category:BIS( |_)File( |_)Formats\]\]" to "Category:Real Virtuality File Formats")
 
Line 56: Line 56:




[[Category:BIS File Formats]]
[[Category:Real Virtuality File Formats]]
[[Category:Introduced with Arma 3 version 0.50]]
[[Category:Introduced with Arma 3 version 0.50]]
[[Category:Introduced with Arma 3 version 1.00]]
[[Category:Introduced with Arma 3 version 1.00]]

Latest revision as of 13:27, 8 May 2025

Arma 3 logo black.png 0.50 same-file support
Arma 3 logo black.png 1.00 full support


The array[] += {} syntax allows to add items to an existing array inherited from the direct parent.


Usage

class A
{
	array[] = { any, thing };
};

class B : A
{
	array += { more, Bstuff };
};

class C : A // inherits from A, -not- B
{
	array += { other, Cstuff };
};


Limitations

Only direct inheritance of an explicitly-stated array works. The following cases do not work:

class A { array[] = { any, thing }; };
class B : A {};
class C : B // inherits from B which inherits from A (without changes)
{
	array[] += { wont, work }; // result: array[] = { wont, work };
};
class A { array[] = { any, thing }; };
class B : A { array[] += { more, stuff }; };
class C : B // inherits from B which inherits from A (with += changes)
{
	array[] += { wont, work }; // result: array[] = { wont, work };
};