Up |
varSet
Set a global variable value
This function should be used by advanced developers only.
Prototype :
fun [S u0] u0
- S : the name of the variable
- u0 : the new value
Return : u0 the value or nil if error/not found. If error, check the type of the new value, a bad type is probably the cause.
See also :
Example
struct Client [
cid = I,
cname : S,
cmail : S,
cregister : S
] mkClient;;
fun main ()=
_showconsole;
_fooId varAdd "varI" "I" "2"; // create varI, type = I, initial value = 2
_fooId varAdd "varF" "F" nil; // create varF, type = F, without initial value
_fooId varAdd "myVarS" S "\"Hello !\""; // create myVarS, type = S, initial value = "Hello"
_fooId varAdd "varC" "Client" nil; // create varC, type = Client, without initial value
_fooId 3 + varGet "varI" nil; // 5
_fooS strcat "text is : " varSet "myVarS" "Hello World";
0;;