getVariable: Difference between revisions
Jump to navigation
Jump to search
Besselinksjm (talk | contribs) (moved note) |
Dr Eyeball (talk | contribs) (syntax with defaultValue) |
||
Line 18: | Line 18: | ||
| [[Any Value]]<br> Returns [[Nothing]] if the variable doesn't exist.<br> Returns [[Anything]] if the object is undefined.<br> |= Return value | | [[Any Value]]<br> Returns [[Nothing]] if the variable doesn't exist.<br> Returns [[Anything]] if the object is undefined.<br> |= Return value | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
|s2= object '''getVariable''' [name, defaultValue] |= Syntax | |||
|p21= object: [[Object]] or [[Location]] |= Parameter 1 | |||
|p22= name: [[String]] - Variable name that was defined in [[setVariable]] ('''Case sensitive''') |= Parameter 2 | |||
|p23= defaultValue: [[Any Value]] - Value to return if variable doesn't exist |= Parameter 3 | |||
|r2= [[Any Value]]<br> Returns ''defaultValue'' if the variable doesn't exist.<br> Returns [[Anything]] if the object is undefined.<br> |= Return value 2 | |||
____________________________________________________________________________________________ | |||
|x1= <code>_aVariable <nowiki>=</nowiki> _myTruck getVariable "myVariable";</code> |= Example 1 | |x1= <code>_aVariable <nowiki>=</nowiki> _myTruck getVariable "myVariable";</code> |= Example 1 | ||
____________________________________________________________________________________________ | |||
| [[setVariable]], [[getVariable (VBS2)]] |= See also | | [[setVariable]], [[getVariable (VBS2)]] |= See also |
Revision as of 11:24, 19 November 2010
Description
- Description:
- Return the value of variable in the variable space of given object or location.
- Groups:
- Uncategorised
Syntax
- Syntax:
- object getVariable name
- Parameters:
- object: Object or Location
- name: String - Variable name that was defined in setVariable (Case sensitive)
- Return Value:
- Any Value
Returns Nothing if the variable doesn't exist.
Returns Anything if the object is undefined.
Alternative Syntax
- Syntax:
- object getVariable [name, defaultValue]
- Parameters:
- object: Object or Location
- name: String - Variable name that was defined in setVariable (Case sensitive)
- defaultValue: Any Value - Value to return if variable doesn't exist
- Return Value:
- Any Value
Returns defaultValue if the variable doesn't exist.
Returns Anything if the object is undefined.
Examples
- Example 1:
_aVariable = _myTruck getVariable "myVariable";
Additional Information
- See also:
- setVariablegetVariable (VBS2)
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note