C:\Users\User\Pictures\gmic-qt-data\tgi>gmic rep_test_vector 5
[gmic]-0./ Start G'MIC interpreter.
[gmic] *** Error in ./rep_test_vector/ (file 'C:\Users\User\AppData\Roaming\user.gmic', line #3) *** Unknown command or filename 'vec[1]=5'; did you mean 'dec'?
rep_test_vector:
vec=[1,2,3]
vec[1]=$1
The only workaround other than modifying command entirely is to create a command command that takes in 1 global image, then swap the value from there. Not quite pretty, but a good solution though.
Just a reminder: outside the math evaluator, a G’MIC variable is always a string. There are not such things as typed variables there (value, array of values, …).
If you want to store a sequence of values in a single variable, then
vec=1,2,3
is OK, but still, remember this is a single string.
If you want to assign another number to the second value of this string, then use the math evaluator:
vec={"v=["$vec"];v[1]=$1;v"}
But again, keep in mind you are actually generating an entire (modified) new string that will be assigned to vec.
In case you are still no sure about that:
Values of G’MIC variables are strings
PS : Inside the math evaluator however, variables are typed, they can be either a scalar value, or a vector of size N, nothing else.
We should collect these things into tutorials and put them in the reference. I don’t see anything about this in the reference, not even in Input Data or Substitution Rules. I recently learned this little rule about how variables are treated the hard way when doing that CIECAM02 thing…
English is not my primary language, and I’m pretty sure there are a lot of typos and sentences that could be reformulated in a clearer and more concise manner.
When I get less busy I should be able to help with that. We need a list of things that aren’t already described in detail, such as the relevant syntax for the plugin GUIs.