View Single Post
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 08:49   Re: [ TUT ]Dynamic Array
Reply With Quote #21

Quote:
Originally Posted by HamletEagle View Post
Do you even read the answers?

Addons said:


Klippy said:


I said:


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]
*/ 

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.
Oohh, I was just confused because in Zombie Plague MerCyLeZZ used 32/64 for models, sounds etc...

Sorry I understand things a little slowly. So if I want to use integers, I can make the cellsize 1, but what if I want to use huge values like 1000000, do I have to use cellsize 7?
__________________

Last edited by edon1337; 02-17-2017 at 08:58.
edon1337 is offline