Hi
Did you come up with a solution? I am also facing the same issue :tostr creates an empty string.
Poste YOUR CODE to make possible to check for errors.
In the previous post the error are: incorrect and incomplete syntax.
The script do:
:local LogVar
declare one undefined empty variable called LogVar of type "nothing"
:set LogVar ".id=*152fd;message=00:0C:42:7F:A2:94@RFSouthG: connected;time=nov/11 22:25:22;topics=wireless;info"
this do nothing, missing $ before LogVar for call already existing variable
:tostr $LogVar
this line do nothing. this command return one value, do not write that value inside $logVar or convert $LogVar.
:put "This is a test on the first line"
ok
:put $LogVar
this write logvar contents, if wrong "set" syntax is used, is empty.
:put "This is the last line"
ok
and that are other syntax errors:
:local LogVar
miss value="";
:set LogVar ".id=*152fd;message=00:0C:42:7F:A2:94@RFSouthG: connected;time=nov/11 22:25:22;topics=wireless;info"
set do not create variables, but assing a value to one already existent variable, $ must be used, and miss value= and ;
:tostr $LogVar
and this? where is put the result? $LogValue remain untouched. must be writed: ":set $LogVar value=[:tostr $LogVar];"
:put "This is a test on the first line"
missing message= and ;
:put $LogVar
missing message= and ;
:put "This is the last line"
missing message= and ;
IN THE TERMINAL THE SCRIPT CAN NOT BE TESTED IF YOU OMIT { AT THE START AND } AT THE END.
fixing all the errors, but not the concept, the result are:
:local LogVar value="";
:set $LogVar value=".id=*152fd;message=00:0C:42:7F:A2:94@RFSouthG: connected;time=nov/11 22:25:22;topics=wireless;info";
:set $LogVar value=[:tostr $LogVar];
:put message="This is a test on the first line";
:put message=$LogVar;
:put message="This is the last line";
and the results (on terminal):
ros code
[admin@MATRIX] > {:local LogVar value="";
{... :set $LogVar value=".id=*152fd;message=00:0C:42:7F:A2:94@RFSouthG: connected;time=nov/11 22:25:22;topics=wireless;info";
{... :set $LogVar value=[:tostr $LogVar];
{... :put message="This is a test on the first line";
{... :put message=$LogVar;
{... :put message="This is the last line";}
This is a test on the first line
.id=*152fd;message=00:0C:42:7F:A2:94@RFSouthG: connected;time=nov/11 22:25:22;topics=wireless;info
This is the last line
[admin@MATRIX] >
�