# Unexpected writing to memory array tags

**URL:** <https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [September 25, 2018, 4:14am UTC](https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799 "2018-09-25T04:14:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![derek.neilson](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@derek.neilson](https://forum.inductiveautomation.com/u/derek.neilson)\
**Post date:** [September 25, 2018, 4:14am UTC](https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799/1 "2018-09-25T04:14:55Z")

</div>

I have a script where I read the value of a memory array tag. I then manipulate the data in my script. I am finding that the value of the tag is being modified by the script even without using system.tag.write()

I’m using 7.9.9

I have made a really simple script that has this behavior so hopefully you can see what I am talking about. In this case, “inttest” is a memory integer array tag.

```auto
test = system.tag.read("inttest").value

test[3] = 7

```

after running this script. the value of the tag inttest[3] will be 7 even though I never wrote back to the tag. Is this intended behavior?

This behavior is similar to lists in python. where you will need to use copy() to create a new instance of the list to avoid modifying the original. However I can’t seem to do this. If I try to run new\_array = copy(test) on the above script, I get the following error: TypeError: ‘module’ object is not callable.

Hopefully this is clear enough.

Thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 25, 2018, 12:05pm UTC](https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799/2 "2018-09-25T12:05:36Z")

</div>

Yikes. This shouldn’t work. Thanks for the report 🙂

---

<div class="post-metadata">

**Author:** ![derek.neilson](https://avatars.discourse-cdn.com/v4/letter/d/c67d28/32.png) [@derek.neilson](https://forum.inductiveautomation.com/u/derek.neilson)\
**Post date:** [September 26, 2018, 4:09am UTC](https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799/3 "2018-09-26T04:09:55Z")

</div>

is there something that I can do to avoid it happening? my array in my actual script is 231 elements long and this is causing the tag to update 231 times instead of once at the end of the script. Its not the end of the world but I imagine its adding extra strain on the system.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 26, 2018, 11:35am UTC](https://forum.inductiveautomation.com/t/unexpected-writing-to-memory-array-tags/19799/4 "2018-09-26T11:35:56Z")

</div>

You’d have to make a copy of the array value before modifying it.
