Mar 12, 2006 at 11:32am
iterating through the whole array and copying value by value works,
was looking around for something like “Array.copy()” – but no luck.
just wanted to know what others are doing in this situation and if
Jun 10, 2006 at 12:59am
those are good tips! I looked through the js core guide, and there simply doesn’t seem to be a method for copying an array to a new one. go figure!
Jun 10, 2006 at 2:35am
On Jun 9, 2006, at 5:59 PM, pnyboer wrote:
> those are good tips! I looked through the js core guide, and there
For numerically arrays, just walk one array from zero to array.length
For associative arrays (i.e. key/value maps, also knows as hash
for (i in src)
Hope this helps.
Jun 12, 2006 at 5:02am
Quote: pnyboer wrote on Sat, 10 June 2006 12:59
Not as such.
newarray = oldarray.slice(0); or
Pretty much the standard one-line methods back when I was doing much js web development. Still what I’m using anyway.
As Joshua notes, you could also add a .copy() method extending the Array prototype and bung that in a shared js library, for that matter, though I haven’t felt the need to do anything like this in Max (yet).
You must be logged in to reply to this topic.