Collapse (?) An Array?

Scott Rossi scott at tactilemedia.com
Thu Sep 1 10:10:26 EDT 2011


Recently, Richard Gaskin wrote:

> The delete is fine; the problem is in the display of the results.
> 
> If you use:
> 
>    put theArray[1] &"*"&theArray[2] &"*"& theArray[3]
> 
> ...you'll get the empty entry for theArray[2].  The variable theArray
> still exists, but there's nothing in that slot.

Yes, this is the problem.  I'm storing data in array form in custom
properties, and my problem is after a delete, the remaining elements of the
array are not reordered.


> Building the output from the keys of the array will get what you want:
> 
>    put the keys of theArray into tKeys
>    sort lines of tKeys -- if the order is important
>    repeat for each line tKey in tKeys
>       put "*"& theArray[tKey] after tResult
>    end repeat
>    put tResult

>From what you're saying, it sounds like I need to put the remaining elements
of the array into a temporary variable and then replace the original array.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX Design






More information about the use-livecode mailing list