Array union syntax: grumble or bug?
David Bovill
david at openpartnership.net
Sun Oct 7 08:07:01 EDT 2007
This one has bothered me for a while now - is there a good reason for these
two rather strange behaviors of the "union" command for arrays:
1) union with an empty base array always result in empty instead of adding
the new array
2) an array is "empty" even if it is not (null) and has stuff in it (same
with other binary data)
So AFAIK to add an array in a repeat loop to an initially empty array you
need to use an awkward and slow handler like the one below:
on array_Add someArray, @toArray
-- why cant we just test if array is empty?
if keys(toArray) is empty then
-- why does "union" with an empty base array always result in empty?
put someArray into toArray
else
union toArray with someArray
end if
end array_Add
More information about the use-livecode
mailing list