Tell me I'm not crazy

Robert Brenstein rjb at robelko.com
Mon Sep 19 16:55:57 EDT 2011


On 19.09.2011 at 15:30 Uhr -0500 Tereza Snyder apparently wrote:
>I recently encountered a problem implementing an undo function in a 
>script. I needed to compare two arrays to see if any values had 
>changed, like this:
>
>put (tArray1 <> tArray2) into sDirtyFlag
>
>so that sDirtyFlag would be true when the arrays failed to match. 
>However, sDirtyFlag was always false! No matter what!
>
>I put the two arrays into globals and compared them in the message 
>box, like this:
>
>put (gArray1 = gArray2), and the result was always correct. I 
>thought there was some hidden horrible error in my script that 
>dementia prevented me from seeing, until I realized that in my 
>script I was using "<>" not "=" to compare.
>

I think you want to compare the keys and the content for each key 
among the arrays. Unless I missed on some new feature in most recent 
livecodes, tArray always gives empty so comparing two arrays this way 
will always give same result when matching, exactly as you observed.

Robert




More information about the use-livecode mailing list