Difference between revisions of "getVariable"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|PARAMETER1= |p22=" to "|PARAMETER21= |p22=")
m (Text replacement - "|PARAMETER3= |r2=" to "|PARAMETER23= |r2=")
Line 47: Line 47:
 
|p23= name: [[String]] - Variable name that was defined in [[setVariable]] |PARAMETER2=
 
|p23= name: [[String]] - Variable name that was defined in [[setVariable]] |PARAMETER2=
  
|p24= defaultValue: [[Anything]] - Value to return if variable doesn't exist |PARAMETER3=
+
|p24= defaultValue: [[Anything]] - Value to return if variable doesn't exist |PARAMETER23=
  
 
|r2= [[Anything]] - current value of the variable or ''defaultValue'' if the variable doesn't exist. |RETURNVALUE= 2
 
|r2= [[Anything]] - current value of the variable or ''defaultValue'' if the variable doesn't exist. |RETURNVALUE= 2

Revision as of 15:01, 3 September 2019

Template:Command

Notes

Bottom Section

Posted on August 13, 2016 - 17:13 (UTC)
Ebay
NOTE: Arma 2 ONLY! In Arma 3 this will return default value. Warning: the alternative syntax returns undefined when the varspace is an object and that object is null. Example:
_test = objNull getVariable ["test","0"]; systemChat _test; Errors because _test is undefined. Tested in A2OA 1.63.131129
Posted on August 31, 2017 - 03:29 (UTC)
AgentRev
You can do typechecking using param: private _myVar = [player getVariable "myVar"] param [0,"",[""]]; and params: [player getVariable "myVar"] params [["_myVar","",[""]]];