AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   checking array length, and creating them dynamically (https://forums.alliedmods.net/showthread.php?t=63923)

orglee 12-03-2007 13:03

checking array length, and creating them dynamically
 
Hello.
I want to create array then use it in loop so i need its length.
Are there some array_fill and count functions ?

Alka 12-03-2007 13:13

Re: checking array length, and creating them dynamically
 
"sizeof" E.g:
Code:

new Array[32];
sizeof Array - will return 32;
 
or
 
new Array[32][128];
sizeof Array[] - will return 128, if you do only "sizeof Array" will return 32.


orglee 12-03-2007 13:16

Re: checking array length, and creating them dynamically
 
Thank you very much :)

M249-M4A1 12-03-2007 17:55

Re: checking array length, and creating them dynamically
 
Oh, and if you wanted to do stuff to the array's elements, be sure that when you loop, you do sizeof - 1, because if you did something with array[32], in Alka's example, you would get errors because array[32] doesnt exist


All times are GMT -4. The time now is 11:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.