View Single Post
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-17-2017 , 08:18   Re: [ TUT ]Dynamic Array
Reply With Quote #20

Do you even read the answers?

Addons said:
Quote:
The 1 you are passing, is the size of each Dynamic Array entry you are storing in the Dynamic Array.
Klippy said:
Quote:
That number is only size for each array entry
I said:
Quote:
The size just determine what data type the array will hold.
Let's try one more time:
PHP Code:
new Array:Test ArrayCreate(1
The 1 tells that you want to save single-cell data(basically numbers).

PHP Code:
new Array:Test ArrayCrete(some_other_number_here), where some_other_number_here 
This means that you will store multicell data(basically arrays). They can be strings or array of numbers.

PHP Code:
new Array:Test ArrayCreate(32
In "Test" you can save as many strings as you want, but one string can't be bigger than 32.

View the array like a list:
PHP Code:
new Array:Test ArrayCreate(1)

Translates to:
/*
var0
var1
var2
var3
.
.
.
varn
*/

new Array:Test ArrayCreate(32)
/*
var0[32]
var1[32]
var2[32]
.
.
.
.
varn[32]
*/ 
Quote:
So if I create an Array with size 1, I can put 100 numbers in it?
If you create an array with cellsize = 1(not of size 1), then you are creating an array of numbers. You can store as much data as you want, but data must be a number, not an array.
There is no cap.

PHP Code:
new Array:MyArray ArrayCreate(1)
for(new 
i9999i++)
{
     
ArrayPushCell(MyArrayi)

We just saved 9999 values.
__________________

Last edited by HamletEagle; 02-17-2017 at 08:22.
HamletEagle is offline