Data Types

From Bohemia Interactive Community
Revision as of 22:20, 24 February 2020 by Lou Montana (talk | contribs) (Change variable types presentation and fix ArmA 2 → Arma 2 link)
Jump to navigation Jump to search

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


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.