LifeSnatcher 2 Posted November 15, 2017 I need to execute the below code only if the global variable v_TLSAO is not empty. I'm new at this so I'm having a hard time figuring out isnil functionality. [v_TLSAO] call LARs_fnc_deleteComp; Share this post Link to post Share on other sites
Tajin 348 Posted November 15, 2017 What is so hard about it? The wiki tells you exactly how it works and even has some examples: https://community.bistudio.com/wiki/isNil Share this post Link to post Share on other sites
pierremgi 4736 Posted November 15, 2017 1 hour ago, LifeSnatcher said: I need to execute the below code only if the global variable v_TLSAO is not empty. I'm new at this so I'm having a hard time figuring out isnil functionality. [v_TLSAO] call LARs_fnc_deleteComp; What is v_TLSAO ? "empty" lets me think it's already an array. In this case, check if you need an array of array... To check if an array is empty: myArray isEqualTo [ ] Share this post Link to post Share on other sites
LifeSnatcher 2 Posted November 17, 2017 v_TLSAO is a string var. it doesn't always have a value. Isnil examples only show what to do on true. i only want it to execute when its false. how do i reverse the condition, what is the syntax. Share this post Link to post Share on other sites
Tajin 348 Posted November 17, 2017 if !(isNil "somevariable") then { // whatever }; Also very useful: _pv = missionNamespace getVariable ["somevariable", 0]; getVariable can return a specified default value if the variable is not defined. Share this post Link to post Share on other sites
Tankbuster 1731 Posted November 17, 2017 4 hours ago, LifeSnatcher said: v_TLSAO is a string var. it doesn't always have a value. You need to be a bit clearer. It's a string - when you say it doesn't have a value, do you mean it's empty string or undefined? 1 Share this post Link to post Share on other sites