|
|
(8 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| {{SideTOC}}
| | #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|arma|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]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Config]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Control]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Display]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Location]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Script (Handle)]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Structured Text]] || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |- <!-- Arma 2 -->
| |
| | [[Diary Record]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Task]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Team Member]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{Checkbox|yes}}
| |
| |-
| |
| | [[Namespace]] || {{task}} || {{task}} || {{Checkbox|yes}} || {{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]]
| |