Scripting with Array Tags

How does one script with array tags?

For instance, I want to create a button that adds an element to an array tag that already exists.

So, I need to read the array, add an element to the end, and then write it back.

What is the exact syntax to do that?

When you read an array tag in a script, you get a python array object. If the tag already has an array value, then you can just read the value from the tag using system.tag.readBlocking then use any method of the array class to manipulate it before you write it back to the tag, or do anything else you want to do with it.

documentation on python arrays:

Here's a quick example of the button you described:

def runAction(self, event):
	tagPaths = ['[default]charArr']
	arrayTag = system.tag.readBlocking(tagPaths)[0].value
		
	arrayTag.append("123")
	system.tag.writeBlocking(tagPaths, [arrayTag])