
Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2018
01:29 PM
roAssociativeArray Appen() doesn't append nested roAssociativeArrays!
I've discovered, to my dismay, that when you append one AA (roAssociativeArray) to another one, if it finds any same keys it will REPLACE it! Yes, I know that's exactly what it says it will do, so good for it for being literal, but I just figured if it found a nested AA it would nicely Append() it, rather than replace it.
This is what I want, or maybe a different but similar command, such as NestAppend() or something.
As it is, I have to manually deal with this, and for now, thankfully only one layer, so I can go through each key/value in the top AA and Append() each of those one at a time, with a big FOR EACH loop.
This is what I want, or maybe a different but similar command, such as NestAppend() or something.
As it is, I have to manually deal with this, and for now, thankfully only one layer, so I can go through each key/value in the top AA and Append() each of those one at a time, with a big FOR EACH loop.
2 REPLIES 2
NB_
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2018
01:43 PM
Re: roAssociativeArray Appen() doesn't append nested roAssociativeArrays!
The name ".append()" is an unfortunate misnomer. Method should have been named ".update()", because that's what it does: A.append(B) adds (if new) to A - or replaces (if pre-existing) - key-value pairs from B. It is a shorter (and faster) version of:
for each key in B
A[key] = B[key]
next

Komag
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2018
10:33 AM
Re: roAssociativeArray Appen() doesn't append nested roAssociativeArrays!
Yeah, that makes it more clear.