Hello Developers,
I'm currently using nasl 2.2.10. I can use the result of a function call
in an expression for further evaluation if the result is of number or
string type. But if the result is an array I can not use it directly,
but have to assign the a variable. The following testcode makes this clear.
function get_num()
{
return 3;
}
if(get_num() == 3)
{
display("this works\n");
}
function get_str()
{
return "octect";
}
if(get_str() == "octect")
{
display("string works\n");
}
function get_array()
{
local_var a;
a["one"]=1;
a["two"]="zwei";
a["three"]="trois";
return a;
}
local_var res; res=get_array();
if(res["three"] == "trois")
{
display("this works too\n");
}
# but this does not :(
if(get_array()["three"] == "trois")
{
display("does not work\n");
}
Now my questions are:
1) Did I use the wrong syntax?
2) Does this work with nasl3?
3) Can it be fixed in nasl2?
--
---> Dirk Jagdmann ^ doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org
_______________________________________________
Plugins-writers mailing list
Plugins-writers@list.nessus.org
http://mail.nessus.org/mailman/listinfo/plugins-writers
I'm currently using nasl 2.2.10. I can use the result of a function call
in an expression for further evaluation if the result is of number or
string type. But if the result is an array I can not use it directly,
but have to assign the a variable. The following testcode makes this clear.
function get_num()
{
return 3;
}
if(get_num() == 3)
{
display("this works\n");
}
function get_str()
{
return "octect";
}
if(get_str() == "octect")
{
display("string works\n");
}
function get_array()
{
local_var a;
a["one"]=1;
a["two"]="zwei";
a["three"]="trois";
return a;
}
local_var res; res=get_array();
if(res["three"] == "trois")
{
display("this works too\n");
}
# but this does not :(
if(get_array()["three"] == "trois")
{
display("does not work\n");
}
Now my questions are:
1) Did I use the wrong syntax?
2) Does this work with nasl3?
3) Can it be fixed in nasl2?
--
---> Dirk Jagdmann ^ doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org
_______________________________________________
Plugins-writers mailing list
Plugins-writers@list.nessus.org
http://mail.nessus.org/mailman/listinfo/plugins-writers