- Joined
- Mar 28, 2016
- Messages
- 1,623
- Reaction score
- 1,439
- First Language
- French
- Primarily Uses
- RMMV
hi
i know i can do the function with (for) and (loop), but logically, am supposed to be able to get the indexOf ?
Why my function to search index in a 2D array alway return me False (-1) ???
If you add this to console.log
//------------------------------------------
gate1=[];
gate1=[[3,4],[4,6]]; // test [[ItemID,NBItem],[ItemID,NBItem]]
//------------------------------------------
function CheckGiveItem(ID, NEED, GVariable) {
var found = [ID[0],NEED[0]]; // = [3,4]
return GVariable.indexOf(found);
}
//------------------------------------------
$dataArmors[1].meta.test = {
//test indexof 2D array
check: CheckGiveItem([3,6,10,11],[4,6,8,7],gate1) //example ([ItemID],[NEED],GlobalGameVariable)
};
and after this to test
$dataArmors[1].meta.test.check
is return me -1
i do the same thing like i read here.
http://stackoverflow.com/questions/1427640/indexof-syntax-for-multidimensional-arrays
i know i can do the function with (for) and (loop), but logically, am supposed to be able to get the indexOf ?
Why my function to search index in a 2D array alway return me False (-1) ???
If you add this to console.log
//------------------------------------------
gate1=[];
gate1=[[3,4],[4,6]]; // test [[ItemID,NBItem],[ItemID,NBItem]]
//------------------------------------------
function CheckGiveItem(ID, NEED, GVariable) {
var found = [ID[0],NEED[0]]; // = [3,4]
return GVariable.indexOf(found);
}
//------------------------------------------
$dataArmors[1].meta.test = {
//test indexof 2D array
check: CheckGiveItem([3,6,10,11],[4,6,8,7],gate1) //example ([ItemID],[NEED],GlobalGameVariable)
};
and after this to test
$dataArmors[1].meta.test.check
is return me -1
i do the same thing like i read here.
http://stackoverflow.com/questions/1427640/indexof-syntax-for-multidimensional-arrays
Last edited by a moderator:

