LT_get_var

 

Contents

Description

Get LabTalk variable value

Syntax

BOOL LT_get_var( LPCSTR lpcszLabTalkVarName, double * lpdbResult )

Parameters

lpcszLabTalkVarName
[input] LabTalk variable name, case insensitive
lpdbResult
[output] the double variable pointed to by lpdbResult recieves the LabTalk variable value

Return

TRUE if lpcszLabTalkVarName is a LabTalk variable, and FALSE if it is not

Examples

EX1

void    LT_get_var_ex1()
{
    double vv;
    LT_get_var("X2", &vv); // get the current X axis right limit (the variable "X2")
    out_double("vv = ", vv);
    LT_get_var("@D",&vv); // get machine curremt date/time as Julian value (the system variable @D)    
    out_double("vv = ", vv);
    if(LT_get_var("XYZ", &vv))    // try to get the value of the variable "XYZ"
        printf("in LabTalk, XYZ = %lf\n", vv);
    else
        out_str("XYZ is not a LabTalk variable");
}

Remark

You can use this command to get LabTalk variables, including system variables whose names begin with @.

This command is similar to LT_evaluate but you can tell if given name corresponds to a LabTalk variable even if its value is missing value, while LT_evaluate will not be able to differentiate. Also, using LT_evaluate to get value of a variable is slower.

See Also

LT_set_var

header to Include

origin.h

Reference