help [][] - 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: help [][] (
/showthread.php?tid=241824)
help [][] -
omer5198 - 18.03.2011
can someone explain what this [][] for? i saw it in few places and i didn't understand what it is...:
new Float:RandomSpawn[][4]
same with weaponsname or something...
Re: help [][] -
JaTochNietDan - 18.03.2011
It's specifying an array, specifically a multi-dimensional array in the example you've shown.
It's initializing an array called RandomSpawn, with an unspecified number of cells in the first dimension (the compiler will decide that when you compile it, by how many items are in it), and the second dimension has 4 cells.
Doing this:
Is pretty much the same as doing this:
It is easier to use arrays with loops and use other values to specify a cell within the array than using seperate variables for each bit of information.
You can read more about it in the Pawn documentation available on the CompuPhase website.
Re: help [][] -
omer5198 - 18.03.2011
Quote:
Originally Posted by JaTochNietDan
It's specifying an array, specifically a multi-dimensional array in the example you've shown.
It's initializing an array called RandomSpawn, with an unspecified number of cells in the first dimension (the compiler will decide that when you compile it, by how many items are in it), and the second dimension has 4 cells.
Doing this:
Is pretty much the same as doing this:
It is easier to use arrays with loops and use other values to specify a cell within the array than using seperate variables for each bit of information.
You can read more about it in the Pawn documentation available on the CompuPhase website.
|
thx!!!