====== set ======
===== Description =====
Set the value of a variable. This is equivalent to the '=' assignment operator in C/C++.
===== Function prototype =====
varref set
===== Arguments =====
^ 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. |
===== Return value =====
NULL if an error occurred, and a valid variable reference otherwise (same as var argument).
===== Example =====
==== Set value of integer from literal ====
int i
set i 50
==== Set value of string from literal ====
string s
set s "hello"
==== Set value of string from a variable ====
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 [[plugins:general:zeoscript:reference:functions:echo]] as:
123.456
==== Set value of an integer from a fucntion ====
int i
set i // 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 [[plugins:general:zeoscript:reference:functions:echo]] as:
2
===== Comments =====
None.
===== See also =====
* [[plugins:general:zeoscript:reference:functions:iseq]]