ABC of arrays

Phil Davis revdev at pdslabs.net
Wed Apr 1 14:07:31 EDT 2015


If you want to see a visual representation of the array, the following 
code will give that to you:

-- your stack has a field and a button

-- button code:

global gSomeBigArray

on mouseUp
     put dataTree(gSomeBigArray) into field 1
end mouseUp


function dataTree pData, pSpacer
     put pSpacer & tab into tNextSpacer
     put the keys of pData into tKeyList
     if line 1 of tKeyList is a number
     then sort lines of tKeyList numeric
     else sort lines of tKeyList
     repeat for each line tKey in tKeyList
         if pData[tKey] is an array
         then put pSpacer & tKey & ":" & CR & 
dataTree(pData[tKey],tNextSpacer) after tDataTree
         else put pSpacer & tKey & " = " & singleLine(pData[tKey]) & cr 
after tDataTree
     end repeat

     return tDataTree
end dataTree


function singleLine pData
    replace CR with "[[CR]]" in pData
    return pData
end singleLine


HTH -
Phil Davis




On 4/1/15 10:44 AM, Thierry Douez wrote:
>> I've never had any problems with "put the keys of myArray".
>> Maybe you expect It to return all the keys of a multidimensional array?
> Jacque,
>
> I think that is what he meant.
>
> Thierry
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>

-- 
Phil Davis





More information about the use-livecode mailing list