Array keys oddity?
Björnke von Gierke
bvg at mac.com
Fri Jun 5 10:58:30 CDT 2009
I am not sure what your problem is, but i can assure you that
everything works fine (i tested your code verbatim, only replace 10
with 20). My guess is that you expect the keys to be in some order.
However the keys will never be ordered by default, and in a seemingly
random order which optimises the speed of access. Factors in this are:
the name of the array
the name of the keys
the length of each key, element and total array
the place the array is stored in memory
also see the documentation entry about "the keys". If you want to have
them in a specific order, you'd need to sort them.
On 5 Jun 2009, at 17:36, DunbarX at aol.com wrote:
> OK, just started playing with arrays, and as usual stopped cold
> after 5
> I have a card with a "field 1" and button containing the following
> on mouseup
> put "" into fld 1
> repeat with y = 1 to 10
> put y & "-" & random(99) into line y of tArray
> end repeat
> put tArray & return into fld 1
> split tArray with return and "-"
> put the keys of tArray after fld 1
> end mouseup
> This has to be me and my understanding of what the keys
> really are. I tried to make as accessable a first array as I could,
> and as usual,
> well, anyway, I can't wait to see...
official ChatRev page:
Chat with other RunRev developers:
go stack URL "http://bjoernke.com/stacks/chatrev/chatrev1.3b3.rev"
More information about the use-livecode