put one array after another

Quentin Long cubist at aol.com
Thu Aug 11 06:56:04 EDT 2016


sez Matt Maier <blueback09 at gmail.com>:
> Is there a command to merge two array variables into one?
> 
> Example:
> 
> tFirstArray[tom] = mot
> tFirstArray[jane] = enaj
> 
> tSecondArray[bill] = llib
> tSecondArray[name] = eman
> 
> put tSecondArray after tFirstArray
> 
> tFirstArray[tom] = mot
> tFirstArray[jane] = enaj
> tFirstArray[bill] = llib
> tFirstArray[name] = eman

I don't know if there's a command that will do the job. However, there's a construction I use when I merge two list variables into one:

put ItemList2 into item (1 + the number of items in ItemList1) of ItemList1

That construction may seem a little weird, but it does the job. So *if* the same sort of logic applies to arrays, something like this might do the job:

function ConcatArray Array1, Array2
  -- if this was a real function, it would confirm that Array1 and Array2 are both, you know, *arrays*
  put the number of lines in the keys of Array1 into A1
  put the keys of Array2 into key (A1 + 1) of Array1
  return Array1
end ConcatArray

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
    
Read the webcomic at [ http://www.atarmslength.net ]!
    
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].




More information about the Use-livecode mailing list