Alternate Form of printKeys()

Bob Sneidar bobs at twft.com
Mon Jan 30 12:57:58 EST 2012


On Jan 28, 2012, at 5:35 AM, Peter M. Brigham, MD wrote:

> if theKey is not a number then
>   replace "[" & theKey & "]" with "[" & quote & theKey & quote & "]" in theKeyList
> end if


Okay new version. Thanks to Peter M. Brigham, MD for pointing this out:

function altPrintKeys @pArray, theKeyList, pFullData
    put numtochar(11) into vertTab
    put numtochar(30) into altCr
    put the keys of pArray into theKeys
    sort theKeys numeric
     
    repeat for each line theKey in theKeys
        put "[" & theKey & "] " after theKeyList
        if theKey is not a number then
              replace "[" & theKey & "]" with "[" & quote & theKey & quote & "]" in theKeyList
        end if
        if pArray[theKey] is an array then
            put pArray[theKey] into theTempArray
            put altPrintKeys(theTempArray, theKeyList, pFullData) after theText
            put empty into the last word of theKeyList
            delete the last char of theKeyList
            put cr into the last char of theText
        else
            put "pArray " & the last word of theKeyList into theKeyName
            -- put "put " & theKeyName & " into theValue" into theCommand
            -- do theCommand
            put the value of theKeyName into theValue
            replace tab with vertTab in theValue
            replace return with altCr in theValue
            put theKeyList & tab & theValue & comma after theText
            put empty into the last word of theKeyList
            delete the last char of theKeyList
        end if
    end repeat
    
    return theText
end altPrintKeys





More information about the use-livecode mailing list