Set the value of a variable. This is equivalent to the '=' assignment operator in C/C++.
varref set <varref:var> <variant:VarValue>
Name | Type | Comment |
---|---|---|
var | varref | A reference to a variable, the value of which is to be set. |
VarValue | variant | The desired value of the variable addressed by hVar, as a variant. |
NULL if an error occurred, and a valid variable reference otherwise (same as var argument).
int i set i 50
string s set s "hello"
float f // create a float 'f', and initialise set f 123.456 string s // create a string 's' set s f // set the value of 's' to be 'f' (this is like 'sprintf(s, "%f", f)' in C) echo s // echo value of string to event log
… the output of which is written to the event log by echo as:
123.456
int i set i <zs:GetLineNo> // set value of 'i' to be current line number (i.e. 2) echo i
… the output of which is written to the event log by echo as:
2
None.