Hi, Peter.
The return value of LT_get_var() function might work better in checking if a Labtalk variable has been set.
It is explained in the file utilities.h that the return value will be TRUE if lpcszLabTalkVarName is a LabTalk variable, and FALSE if it is not for the function:
BOOL LT_get_var(LPCSTR lpcszLabTalkVarName, double * lpdbResult); // Get LabTalk variable value
I think the code can be rewritten as:
void CheckVar(string strvar)
{
double outdouble;
bool bRet = LT_get_var(strvar, &outdouble);
if (bRet) out_double("Val : =", outdouble);
else out_str("This variable has not been set");
}
Deanna
OriginLab Technical Services