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 - "{{Checkbox|yes}}" to "{{Icon|checked}}")
Line 25: Line 25:
! Type !! {{Name|ofp|short}} !! {{Name|arma1|short}} !! {{arma2}} !! {{arma3}}
! Type !! {{Name|ofp|short}} !! {{Name|arma1|short}} !! {{arma2}} !! {{arma3}}
|-
|-
| [[Array]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Array]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Boolean]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Boolean]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Group]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Group]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Number]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Number]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Object]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Object]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Side]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Side]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[String]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[String]] || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|- <!-- ArmA -->
|- <!-- ArmA -->
| [[Code]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Code]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Config]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Config]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Control]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Control]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Display]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Display]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Location]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Location]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Script (Handle)]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Script (Handle)]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Structured Text]] || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Structured Text]] || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}} || {{Icon|checked}}
|- <!-- Arma 2 -->
|- <!-- Arma 2 -->
| [[Diary Record]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Diary Record]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Task]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Task]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Team Member]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Team Member]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[Namespace]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| [[Namespace]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}} || {{Icon|checked}}
|-
|-
| [[HashMap]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}}
| [[HashMap]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}}
|-
|-
| [[HashMapKey]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Checkbox|yes}}
| [[HashMapKey]] || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|unchecked}} || {{Icon|checked}}
|}
|}



Revision as of 01:00, 8 February 2021

The data type of a variable specifies which data it may contain. Certain operators and scripting commands require variables to be of certain types.


Definition

The data type of a variable depends on the value given to it on initialization.

myVar = ""; // myVar is now a String

a local variable should be prefixed with private (Arma 3) or local (Arma 2) to avoid a potential upper-scope variable overwrite:

private _myLocalVariable = "";	// Arma 3
local _myLocalVariable = "";	// Arma 2


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 = "";	// myVar is a String
myVar = 0;	// myVar is now a Number


Available Types

Type OFP ArmA Arma 2 Arma 3
Array Checked Checked Checked Checked
Boolean Checked Checked Checked Checked
Group Checked Checked Checked Checked
Number Checked Checked Checked Checked
Object Checked Checked Checked Checked
Side Checked Checked Checked Checked
String Checked Checked Checked Checked
Code Unchecked Checked Checked Checked
Config Unchecked Checked Checked Checked
Control Unchecked Checked Checked Checked
Display Unchecked Checked Checked Checked
Location Unchecked Checked Checked Checked
Script (Handle) Unchecked Checked Checked Checked
Structured Text Unchecked Checked Checked Checked
Diary Record Unchecked Unchecked Checked Checked
Task Unchecked Unchecked Checked Checked
Team Member Unchecked Unchecked Checked Checked
Namespace Unchecked Unchecked Checked Checked
HashMap Unchecked Unchecked Unchecked Checked
HashMapKey Unchecked Unchecked Unchecked Checked

Magic Types

There are some magic data types, which are not really datatypes, as they do not describe any particular value.


Syntactical Helper Types

Some more types are used to provide for a construction of syntactically richer constructs than normal unary / binary operators.