the keys of myArray

jbv jbv.silences at club-internet.fr
Fri Sep 8 12:23:35 EDT 2006



Richard,

your suggestion for asking the list for help to optimize speed of a script
is wise, but really, I don't have any such problem right now...

the only thing that just crossed my mind is : what if you want to output the
keys of an array in the same order as you created them ? so far the only
way to do that I can think of is to maintain an extra variable in which you
accumulate keys (as items) when you create them...
may be it's just me, but I would expect Rev to output keys in the same
order as they were created... that would be more handy...

BTW here's a little experiment I just did :

I created keys in an array in the following order :
1
4
5
11
52
500
555

"the keys of myArray" outputs this :
1
11
4
500
5
555
52

then I created the same keys but in reverse order :
555
500
52
11
5
4
1

and "the keys of myArray" outputs this :
1
11
4
5
500
52
555

if anyone sees any logic in the above, please let me know...
I think I'll ask rev support about this...

>
>
> > BTW here's a suggestion for a slight improvement of the "keys" function :
> >     get the numKeys of myArray  -->  outputs the keys in numeric order
> >     get the alphaKeys of myArray  -->  outputs the keys in alphabetic order
>
> Those might be handy indeed -- have you submitted those requests to BZ?

haven't found the time yet...
before I proceed, may be some list members have some better ideas
to improve my proposition ?

Best,
JB




More information about the use-livecode mailing list