Hi. I'm new to NetXMS and I'm loving it - it's great.
I'm using ver 2.0.2, and I'm trying to write function for a common task in script library which should return array. However returned value is string with text that looks like it is reference to the array or similar. So I have in one script library called cfunctions:
then in another script i have:
If I try to use data[1] after call to my function I get error that object is not a container, if I print typeof(data) I get that it is string, and if I print variable data I get someting like: [A@0x7ff74c30c9f9].
I also tried to create array in getToken function and populate it one by one (array retr; retr[1]=..., retr[2], .... return retr;) but I get same problem.
So how can I return and use returned array from my function.
Thank you.
I'm using ver 2.0.2, and I'm trying to write function for a common task in script library which should return array. However returned value is string with text that looks like it is reference to the array or similar. So I have in one script library called cfunctions:
Code Select
sub getToken(data) {
text=data[1];
delimiter=data[2];
position=data[3];
i=index(text,delimiter,position);
if (i==0) {
token=substr(text,position);
position=null;
} else {
token=substr(text,position,i-position);
position=i+1;
}
return %(text,delimiter,position,token);
}then in another script i have:
Code Select
use cfunctions;
t="aa,bb,cc,dd";
delimiter=",";
position=1;
array data;
data[1]=text;
data[2]=delimiter;
data[3]=position;
data[4]="";1
data=cfunctions.getToken(data);
...If I try to use data[1] after call to my function I get error that object is not a container, if I print typeof(data) I get that it is string, and if I print variable data I get someting like: [A@0x7ff74c30c9f9].
I also tried to create array in getToken function and populate it one by one (array retr; retr[1]=..., retr[2], .... return retr;) but I get same problem.
So how can I return and use returned array from my function.
Thank you.