Data Types: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Checkbox|no}}" to "{{Icon|unchecked}}")
m (Text replacement - "^#redirect \[\[" to "#REDIRECT [[")
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{TOC|side}}
#REDIRECT [[:Category: Data Types]]
The '''data type''' of a [[Variables|variable]] specifies which data it may contain. Certain [[Operators|operators]] and [[:Category:Scripting Commands|scripting commands]] require variables to be of certain types.
 
 
== Definition ==
 
The data type of a variable depends on the value given to it on [[Variables#Initialization|initialization]].
myVar = ""; {{cc|myVar is now a [[String]]}}
 
a local variable should be prefixed with '''[[private]]''' ({{arma3}}) or '''[[local]]''' ({{arma2}}) to avoid a potential upper-[[Variables#Scopes|scope]] variable overwrite:
[[private]] _myLocalVariable = ""; {{cc|{{arma3}}}}
[[local]] _myLocalVariable = ""; {{cc|{{arma2}}}}
 
 
== Redefinition ==
 
The data type of a variable may be changed at any point of the game by just redefining the variable with another type.
myVar = ""; {{cc|myVar is a [[String]]}}
myVar = 0; {{cc|myVar is now a [[Number]]}}
 
 
== Available Types ==
 
{| class="wikitable sortable"
! Type !! {{Name|ofp|short}} !! {{Name|arma1|short}} !! {{arma2}} !! {{arma3}}
|-
| [[Array]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Boolean]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Group]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Number]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Object]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Side]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[String]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|- <!-- ArmA -->
| [[Code]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Config]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Control]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Display]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Location]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Script (Handle)]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Structured Text]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|- <!-- Arma 2 -->
| [[Diary Record]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Task]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Team Member]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[Namespace]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
| [[HashMap]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}}
|-
| [[HashMapKey]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}}
|}
 
== Magic Types ==
 
There are some magic data types, which are not really datatypes, as they do not describe any particular value.
 
* [[Any Value]]
* [[Anything]]
* [[Nothing]]
* [[Void]]
 
 
== Syntactical Helper Types ==
 
Some more types are used to provide for a construction of syntactically richer constructs than normal unary / binary operators.
 
* [[If Type]]
* [[While Type]]
* [[Switch Type]]
* [[For Type]]
 
 
[[Category: Data Types]]

Latest revision as of 23:03, 24 June 2022