Problem array
#1

Hello all,

I want to do something, it's possible to lister a array with a number and not pPass, pLevel, pAdmin, etc...

PHP Code:

enum e_02
{
        
id,
        
valeur,
        
www,
        
xxx,
        
yyy
};
new 
tab[e_02];
tab[id] = 5;
tab[valeur] = 4;
tab[www] = -6;
       
for(new 
isizeof(tab); i++) printf("tab[%i] = %d"itab[i]); // problem with tab[i] 
Thanks
Reply
#2

Well you could create a tagless array or you add the type before normal variables

pawn Code:
new tab[_: e_02]; // disables strings in enums
// or (not and)
for(new i; i < sizeof(tab); i++) printf("tab[%i] = %d", i, tab[e_02: i]);
Reply
#3

Thanks,

And now, exist a functions to know if is a integer, a float, or a string ?

Jonas
Reply
#4

Well no, there is only the operator tagof()
But strings have no tag like a int and therefore you can't tell the difference

Also using tagof with an array and a variable index it will return the type of the array
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)