Data Types: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Change variable types presentation and fix ArmA 2 → Arma 2 link)
m (Text replacement - "{{task/}}" to "{{Checkbox|yes}}")
Line 25: Line 25:
! Type !! {{Name|ofp|short}} !! {{Name|arma|short}} !! {{arma2}} !! {{arma3}}
! Type !! {{Name|ofp|short}} !! {{Name|arma|short}} !! {{arma2}} !! {{arma3}}
|-
|-
| [[Array]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Array]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Boolean]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Boolean]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Group]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Group]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Number]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Number]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Object]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Object]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Side]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[Side]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[String]] || {{task/}} || {{task/}} || {{task/}} || {{task/}}
| [[String]] || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|- <!-- ArmA -->
|- <!-- ArmA -->
| [[Code]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Code]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Config]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Config]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Control]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Control]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Display]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Display]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Location]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Location]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Script (Handle)]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Script (Handle)]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Structured Text]] || {{task}} || {{task/}} || {{task/}} || {{task/}}
| [[Structured Text]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|- <!-- Arma 2 -->
|- <!-- Arma 2 -->
| [[Diary Record]] || {{task}} || {{task}} || {{task/}} || {{task/}}
| [[Diary Record]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Task]] || {{task}} || {{task}} || {{task/}} || {{task/}}
| [[Task]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Team Member]] || {{task}} || {{task}} || {{task/}} || {{task/}}
| [[Team Member]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|-
|-
| [[Namespace]] || {{task}} || {{task}} || {{task/}} || {{task/}}
| [[Namespace]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
|}
|}



Revision as of 05:11, 26 December 2020

Template:SideTOC 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 Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Boolean Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Group Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Number Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Object Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Side Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
String Template:Checkbox Template:Checkbox Template:Checkbox Template:Checkbox
Code Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Config Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Control Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Display Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Location Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Script (Handle) Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Structured Text Template:task Template:Checkbox Template:Checkbox Template:Checkbox
Diary Record Template:task Template:task Template:Checkbox Template:Checkbox
Task Template:task Template:task Template:Checkbox Template:Checkbox
Team Member Template:task Template:task Template:Checkbox Template:Checkbox
Namespace Template:task Template:task Template:Checkbox Template:Checkbox


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.