I don't know maybe I am doing this wrong but it has worked with other languages I have used. But my problem is that I am trying to nest an array inside of another array for example
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) });
Now I am trying to get the first value from the first array using
int num = arr[3][0]
Now I get the error saying
Expected: int Got: array
Maybe I am overly tired? But I know I have used this before.
Regards, Dennis
--------------------------------- Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
Now I get the error saying
Are you sure you're doing the right thing with the right stuff?
| > array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) }); | > arr[3][0]; | (1) Result: 20 | > int num=arr[3][0]; | >
werror("%O\n",x) might be your friend.
/ Mirar
Previous text:
2004-07-02 13:14: Subject: Indexing wrong?
I don't know maybe I am doing this wrong but it has worked with other languages I have used. But my problem is that I am trying to nest an array inside of another array for example
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) });
Now I am trying to get the first value from the first array using
int num = arr[3][0]
Now I get the error saying
Expected: int Got: array
Maybe I am overly tired? But I know I have used this before.
Regards, Dennis
Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish.
/ Brevbäraren
Hello,
I don't know maybe I am doing this wrong but it has worked with other languages I have used. But my problem is that I am trying to nest an array inside of another array for example
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) });
Now I am trying to get the first value from the first array using
int num = arr[3][0]
In this case you are not getting the first value from the first array but the first value (20) from the last element in the array arr (({ 20, 0 })).
Now I get the error saying
Expected: int Got: array
What is your Pike version ?
It works for me:
Pike v7.6 release 9 running Hilfe v3.5 (Incremental Pike Frontend)
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) }); arr[3][0];
(1) Result: 20
int num = arr[3][0];
/ David Gourdelier
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 20, 0 }) });
Now I am trying to get the first value from the first array using
int num = arr[3][0]
In this case you are not getting the first value from the first array
Yes, he is:
array(mixed) arr = ({ 0, 0, 0, ({ 20, 0 }), ({ 40, 0 }) }); arr[3][0];
(1) Result: 20
but the first value (20) from the last element in the array arr (({ 20, 0 })).
arr[4][0];
(2) Result: 40
Now I get the error saying
Expected: int Got: array
What is your Pike version ?
It works for me:
Works for me too (c), with 7.6.9, 7.4.35 and 7.2.556.
pike-devel@lists.lysator.liu.se