Delete an Array Entry?

Dave Cragg dave.cragg at lacscentre.co.uk
Thu Mar 1 12:23:14 EST 2007


On 1 Mar 2007, at 15:16, Dave wrote:

> Yes, that's what I thought, so:
>
>>> delete global myArray[17]
>
> does not delete the 17th element, unless the key "17" just happens  
> to the 17th element. The documentation is confusing on this point.  
> Also the whole name "Array" for this datatype is confusing, a  
> better name would be "table", since it doesn't behave like an array  
> at all.

I agree this can be confusing. I haven't read the documentation  
recently, but I remember being caught out in the past when the docs  
implied that arrays could have "numerical" keys. I was under the  
impresson that deleting a key from such an array would re-order the  
key numbering, but, of course, it didn't.

I wouldn't like to get into a discussion about whether this is a  
"proper" array. The term "associative array" is pretty widely used,  
and it's an extremely useful tool. It would be nice to have standard  
arrays too, I guess, but if we can only have one type, I'll vote for  
what we have now.

Cheers
Dave



More information about the use-livecode mailing list