Array+=: Difference between revisions
Jump to navigation
Jump to search
m (it is vs its) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 1: | Line 1: | ||
The array[]+={} syntax for | The array[]+={} syntax for {{arma3}} was introduced as an attempt to add unique weapons (or magazines) to a unit without the tedium of duplicate-typing all the basic items. | ||
It originally had a text-only interpreter making it quite impossible to generate config.bin's versus config.cpp's. Later, Binarize was modified to create new token code for this syntax. This token code is broken as it bears no relationship to any other tokenised output. It 'works' simply because its data format can be ignored. | It originally had a text-only interpreter making it quite impossible to generate config.bin's versus config.cpp's. Later, Binarize was modified to create new token code for this syntax. | ||
This token code is broken as it bears no relationship to any other tokenised output. It 'works' simply because its data format can be ignored. | |||
It is not present in any form in any of the official addons accompanying | It is not present in any form in any of the official addons accompanying {{arma3}}. | ||
<!-- //commented until somebody looks into this article | <!-- // commented until somebody looks into this article | ||
As a command it is almost totally useless. Since nested hierarchy isn't permitted, it is pointless. | As a command it is almost totally useless. Since nested hierarchy isn't permitted, it is pointless. | ||
--> | --> | ||
== Usage == | |||
<syntaxhighlight lang="cpp"> | |||
class A | |||
{ | |||
array[] = { any, thing }; | |||
}; | |||
class B : A | |||
{ | |||
array += { more, Bstuff }; | |||
}; | |||
class C : A // inherits from A, -not- B | |||
{ | |||
array += { other, Cstuff }; | |||
}; | |||
</syntaxhighlight> | |||
{{Feature|warning|2= | |||
Only '''direct inheritance''' of an explicitly-stated array works. The following cases do '''not''' work: | |||
{{{!}} style="width: 100%" | |||
{{!}} style="width: 50%" {{!}} | |||
<syntaxhighlight lang="cpp"> | |||
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 }; | |||
}; | |||
</syntaxhighlight> | |||
{{!}} | |||
<syntaxhighlight lang="cpp"> | |||
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 }; | |||
}; | |||
</syntaxhighlight> | |||
{{!}}} | |||
}} | |||
[[Category:BIS File Formats]] | [[Category:BIS File Formats]] |
Revision as of 12:16, 27 May 2022
The array[]+={} syntax for Arma 3 was introduced as an attempt to add unique weapons (or magazines) to a unit without the tedium of duplicate-typing all the basic items.
It originally had a text-only interpreter making it quite impossible to generate config.bin's versus config.cpp's. Later, Binarize was modified to create new token code for this syntax. This token code is broken as it bears no relationship to any other tokenised output. It 'works' simply because its data format can be ignored.
It is not present in any form in any of the official addons accompanying Arma 3.
Usage
class A
{
array[] = { any, thing };
};
class B : A
{
array += { more, Bstuff };
};
class C : A // inherits from A, -not- B
{
array += { other, Cstuff };
};