Get value at index with foreach
#7

I fixed it by making this function:

PHP код:
#define Iter_Index(%1,%2) Itter_Index(_Y_ITER_ARRAY:%1@YSII_Ag,%2,_Y_ITER_ARRAY_SIZE(%1))
stock Itter_Index(array[], indexsize)
{
    new 
cont 0,
        
last size,
        
next = array[last];
    while(
cont index)
    {
        
last next;
        
next = array[last];
        
cont++;
    }
    return 
next;

Use:
PHP код:
new value Iter_Index(IteratorNameindex); 
PHP код:
new Iterator:test<5>;
Iter_Add(test4);
Iter_Add(test0);
Iter_Add(test2);
Iter_Index(test1); // return 2 as the array will be ordered in ascendent order 
Reply


Messages In This Thread
Get value at index with foreach - by Aviicix - 11.04.2017, 14:46
Re: Get value at index with foreach - by Aviicix - 11.04.2017, 15:14
Re: Get value at index with foreach - by Aviicix - 12.04.2017, 09:50
Re: Get value at index with foreach - by OneDay - 12.04.2017, 09:54
Re: Get value at index with foreach - by Aviicix - 12.04.2017, 10:09
Re: Get value at index with foreach - by raydx - 12.04.2017, 10:31
Re: Get value at index with foreach - by Aviicix - 13.04.2017, 21:26
Re: Get value at index with foreach - by DRIFT_HUNTER - 13.04.2017, 22:38
Re: Get value at index with foreach - by Aviicix - 14.04.2017, 07:20

Forum Jump:


Users browsing this thread: 1 Guest(s)