David,
You can do this with:
if arrayEncode(array1) is arrayEncode(array2) then
-- do whatever
end if
--
Best regards,
Mark Schonewille
Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553
Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other
colour spaces. http://www.color-converter.com
We have time for new software development projects. Contact me for a quote.
On 3/24/2013 03:40, David Beck wrote:
Here is a function, in the mean time, that will do a deep comparison of arrays:
function arraysAreEqual array1, array2
if array1 is not array2 then return false
put the keys of array1 into theKeys
repeat for each line thisKey in theKeys
put 0 into numberOfArrays
if array1[ thisKey ] is an array then add 1 to numberOfArrays
if array2[ thisKey ] is an array then add 1 to numberOfArrays
if numberOfArrays is 1 then return false
if numberOfArrays is 2 then
if not arraysAreEqual( array1[ thisKey ], array2[ thisKey ] ) then
return false
end if
end repeat
return true
end arraysAreEqual
On Mar 23, 2013, at 12:43 PM, David Beck <da...@rotundasoftware.com> wrote:
If one has two nested arrays, can you compare the two for equality by doing
if deepArray_1 is deepArray_2 then
-- do whatever
end if
It looks like this does not work. That is, you get false positives at times
when the two arrays are in fact not equal. Can not find documentation to
determine whether this is bug of the expected behavior!
David Beck
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode