Array Tools doesn't work, no array value is returned

When performing a Shuffle, Sort operation on arrays, the value of the array does not change as a result.
Usage example:

  1. Created a scene variable:
    image

  2. First, I display the current value, then I sort it, and display the result:
    image

  3. As a result, the value does not change:
    image

If you use JavaScript of the same function and change the event code like this:
image

Then the result will be correct:
image

I wrote an extension that an empty array should be passed to. It fills up and returns. As an example, I took the Array Tools extension and found this problem that the value is not returned, the passed array does not change (in the extension this happens, but the value is not returned).

If you write the code in the extension like this:
image

Call:
image

First, the array will be empty. Secondly, if you look at what is displayed in the console, it turns out strange:
image

The array is empty when passed, and in the “Argument” line it is returned with filled values. A similar thing happens when it is executed through JavaScript, but already in events (without extension). But the resulting array is not empty:
image

Result:
image

Test project: array_generator.json

The extension expects a variable name. The expression that you are using, VariableString, does not return the variable, but the textual value of it.
Simply replace this: image by this: image

1 Like

Thanks. My stupid mistake.
Tell me why then this strange behavior occurs when outputting to the console. Here’s another example where I’ll add console output to the Sort function of the Array Tools extension:
image

Console output:

Before and after applying the operation, the arrays are completely the same, although we passed the array unsorted (312). I gave similar examples above in the post. Why it happens?