Functions : How to return more than one result, or an array?

Hi !
I need to return a couple of values in a Function. I tried to return an array, but it does not work, the result is set just one time, and not updated when I call the function multiple times… (everything is well if returning a single value). Here is a part of my setup :
(it’s just for testing, as I really need to return a couple of vectors)

image

Hi @mokauno

The reason why it returns only once is because of the Arrays used. The values in the Array node can be set only once and cannot be modified directly. To modify values inside an array, you need the “Array Set” node.

So, to solve this issue of returning multiple values you have to set the array values when the function is called and then return the array:

Later, you can access this array at the output:

Hope this helps!