Juha Heinanen writes:

> is it possible to index dsm arrays using a variable? i have tried many
> variations without luck and could not find anything from the docs.
> 
>   set($a[0] = 1);
>   set($a[1] = 2);
>   for ($n in $a) {
>     info("n is $n");
>   };
> 
>   set($m = $a[0]);
>   info("m is $m");
> 
>   set($i = 0);
>   set($m = $a[$i]);
>   info("m is $m");

the only way that i figured on how to get value of array at a particular
index was to actually look for it:

  set($a[0] = 1);
  set($a[1] = 2);
  set($a[2] = 3);
  set($look = 1);
  set($i = 0);
  for ($n in $a) {
    if test($i == $look); {
      set($result = $n);
    };
    inc($i);
  };
  info("********** got $result");

correctly produced:

Nov 25 09:54:14 lohi sems[21000]: [#7f5361f16700] [execute, 
DSMCoreModule.cpp:634] INFO:  FSM: '********** got 2'

but there must be a more easy and efficient way.

-- juha
_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to