Home   Help Search Login Register  

Author Topic: count subarrays from masterarray  (Read 438 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
count subarrays from masterarray
« 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
« Last Edit: 24 Jun 2004, 17:37:06 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Unnamed

  • Guest
Re:count subarrays from masterarray
« Reply #1 on: 24 Jun 2004, 18:01:18 »
Try something like this:

Code: [Select]
SubArrayCount=0

{SubArrayCount=SubArrayCount+(Count _x)} ForEach MasterArray

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:count subarrays from masterarray
« Reply #2 on: 24 Jun 2004, 18:16:57 »
Excellent, thanks a lot, works a treat :)

who do i have to thank??
« Last Edit: 24 Jun 2004, 18:17:25 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123