# 2.2.4.24.24 Layer::LT_get_var

## Description

Get LabTalk variable value with a specific layer as the active layer.

## 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

//Get the index of the graph layer.
void   Layer_LT_get_var_ex1()
{
double vv;
GraphPage gp;
gp.Create("Origin");
GraphLayer gl = gp.Layers(1);
gl.LT_get_var("layer.cindex", &vv);
//output the index of the layer.(0-based)
out_double("index=", vv);
}

## Remark

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

The Layer Object is only temporarily set as the active layer. The Layer that was active before the code executes is restored as active upon return.

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.

origin.h