fsVarsIVarGet

The fsVarsIVarGet function can be used to get the value of a specific IVar.

 

Syntax
FsVarError fsVarsIVarGet(
    FsLVarId iVarId,
    FsUnitId unitId,
    double* result,
    FsObjectId target
);

 

Parameters
Parameters Description
iVarId

The ID of an IVar (found using fsVarsGetIVarId or fsVarsRegisterIVar).

unitId The ID of a unit (found using fsVarsGetUnitId).
result The variable that will receive the value of the IVar if the other parameters are correct.
target

The ID of the object from which the variable is being retrieved.

Possible targets are:

  1. FS_OBJECT_ID_USER_AIRCRAFT
  2. FS_OBJECT_ID_USER_AVATAR
  3. FS_OBJECT_ID_USER_CURRENT

Default: FS_OBJECT_ID_USER_AIRCRAFT.

 

Return Values

The function returns FsVarError, where 0 means there is no error (in which case, the value of the IVar has been set in result).

 

Example
FsUnitId unitId = fsVarsGetUnitId("DEGREES");
FsIVarId iVarId = fsVarsRegisterIVar("Toto", "LIGHTING");
double result = 0;
if (fsVarsIVarGet(iVarId, unitId, &result) == FS_VAR_ERROR_NONE)
{
    // valid
}
else
{
    // error
}