SA-MP Forums Archive
Size of a dimension - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Size of a dimension (/showthread.php?tid=171522)



Size of a dimension - Luka P. - 26.08.2010

I'm wondering how to get the size of some other variable dimension, not first. So for example lets say I do:
Код:
new string[3][128];
that will obviously create me 3 "string" called variables with a size of 128 cells, each. So I want to get the size of the string[0], and it should be 128, but I'm unable to. I'm only able to get the size of the root "string" variable (size = 3). Currently I am doing
Код:
sizeof(string[0])
but it just won't compile.

Any solutions?


Re: Size of a dimension - Toni - 26.08.2010

I don't know if this is what you meant, but trying adding it with a loop:
pawn Код:
for(new i = 0; i < sizeof(string[0])-1; i++)
{
//Code or something
}
Just using sizeof, with -1 to go through all of it.

Edit: l33t Luka.


Re: Size of a dimension - Luka P. - 26.08.2010

You didn't got me. I'm trying to get the size of string[0] using sizeof(string[0]) but I'm unable to, it wont compile. You can get the size only of the "string" - sizeof(string), but not any additional dimension like string[0], string[1], etc.


Re: Size of a dimension - Luka P. - 05.09.2010

BUMP! Anyone got the solution?


Re: Size of a dimension - DiddyBop - 05.09.2010

OH your trying to get the size of a string, like string[1], string[2], string[3] ?