OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Terox on 24 Jun 2004, 17:09:44

Title: count subarrays from masterarray
Post by: Terox on 24 Jun 2004, 17:09:44
Example

ArrayA = [1,2,3,4,5]
ArrayB = [6,7,8,9,10]
ArrayC = [11,12,13,14,15]

Masterarray = [ArrayA,ArrayB,ArrayC]




have tried various coinfigurations of the following line but cant seem to get the syntax correct
Subarraycount = {count _x select 0} foreach Masterarray

answer should be 15

I want to query the Masterarray elements and count the number of subarray elements each has


Thanks in advance for any help offered
Title: Re:count subarrays from masterarray
Post by: Unnamed on 24 Jun 2004, 18:01:18
Try something like this:

Code: [Select]
SubArrayCount=0

{SubArrayCount=SubArrayCount+(Count _x)} ForEach MasterArray
Title: Re:count subarrays from masterarray
Post by: Terox on 24 Jun 2004, 18:16:57
Excellent, thanks a lot, works a treat :)

who do i have to thank??