Thread: [Solved] loop entitys
View Single Post
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-16-2022 , 00:16   Re: loop entitys
Reply With Quote #2

I'm not sure how you don't get any index out-of-bounds errors because you're trying to index an array from 0 to 99 where the array is much much smaller than 100 (in your case 4 or 5 depending on which function call you're using).

You can actually determine the size of the provided array by using the sizeof directive as the default for a "length" parameter:

PHP Code:
myFunction(myArray[], len sizeof myArray)
{
    
server_print("Array Size: %d"len)

where

PHP Code:
    myFunction({1,3,5})
    
myFunction({1})
    
myFunction({2,34,3.34,3.0,34.0,34,0.0}) 
results in:

Code:
Array Size: 3
Array Size: 1
Array Size: 7
__________________
fysiks is offline