How to get the size of an array from Pawn
#1

How to get the size of an array passed to a native function?

Let's say i have this native definition in the pwn file:
pawn Code:
native Bla(a1[], a2[]);

//then i use like this:
Bla( {1, 13}, {2, 3, 1, 7} );
I need the size of a1 and a2 (2 and 4 in this example), in my plugin. How to do this?

I know a trick to get the size of ONE array if there is only one argument in the native definition, but for 2 arrays as 2 different arguments, i'm stuck!


Edit: ok i can get the size of the first array by doing this:
pawn Code:
static cell AMX_NATIVE_CALL Bla(AMX *amx, cell *p)
{
  printf("sizeof a1 = %d\n", (p[2]-p[1])/4);
  //printf("sizeof a2 = %d\n", ?????);
  return 0;
}
So this is basically all i needed, but if i could get the size of a2 it still would be nice...
Reply


Messages In This Thread
How to get the size of an array from Pawn - by yom - 29.05.2009, 08:06
Re: How to get the size of an array from Pawn - by boylett - 29.05.2009, 11:10
Re: How to get the size of an array from Pawn - by yom - 29.05.2009, 15:52
Re: How to get the size of an array from Pawn - by yom - 01.06.2009, 01:23
Re: How to get the size of an array from Pawn - by yom - 01.06.2009, 01:45

Forum Jump:


Users browsing this thread: 2 Guest(s)