getVariable – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
(another way...)
mNo edit summary
Line 7: Line 7:
This also works:
This also works:


_check = _obj getVariable "myVar";
  _check = _obj getVariable "myVar";
if (isNil "_check") then
  if (isNil "_check") then
{
  {
  // initialize it
      // initialize it
};
  };


--[[User:Raedor|raedor]] 10:47, 12 January 2008 (CET)
--[[User:Raedor|raedor]] 10:47, 12 January 2008 (CET)

Revision as of 10:48, 12 January 2008

Only way I found to see if variable had even been assigned:

 if (format ["%1", _obj getVariable "myVar"] == "<NULL>") then {
  // initialize it
 };

--Doolittle 06:14, 11 January 2008 (CET)

This also works:

  _check = _obj getVariable "myVar";
  if (isNil "_check") then
  {
     // initialize it
  };

--raedor 10:47, 12 January 2008 (CET)