Delete an Array Entry?

Dave dave at looktowindward.com
Thu Mar 1 10:16:29 EST 2007


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.

All the Best
Dave

On 1 Mar 2007, at 14:45, Dave Cragg wrote:

>>
>>  delete global myArray[17] -- removes 17th element of that array
>>
>> Correct? Does it remove the 17th element, rather the element with  
>> the Key that is "17" ?
>
> It deletes the key that is named "17". Try the following to check:
>
> on mouseUp
>   repeat with k = 1 to 20
>      put "abc" into tArray[k * 2 + 1]
>   end repeat
>
>   delete variable tArray[17]
>   put keys(tArray)
> end mouseUp
>
>
>
> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list