Forum Discussion
NB_
9 years agoRoku Guru
"parag" wrote:
So, if I am getting this correctly, I should use a ContentNode for a field in the scene. Would that be different from using associative array? Would that not be immutable? Or am I completely off base?
[...]
ContentList is an roArray type. So, while I can change the title, I can't make any changes to for ex the title field in the associative array in the ContentList array or add another item to the array. Should all the hierarchical components if they are not of intrinsic types be a ContentNode? Thanks.
Using Node or ContentNode field to hold your data is different that using roAA/roArray in that yes, from your point of view node fields are mutable "in place". And yes, if you want to modify your complex structures in place, you should use Node/ContentNode instead of roAA/roArray. Would it help if in the context of node fields only you think about arrays/dictionaries as "by value" primitive types - and all roSgNode subtypes as "by reference" objects?
Why are you not using the component's `m` variable? Is it because you want to mutate a complex structure from outside?
Related Content
- 2 years ago
- 6 months ago
- 4 months ago