These days I’m trying to study AnyScript++ and ClassExamples in the Documentation/AnyScriptReference/demo folder.
I have two questions.
Is there a kind of ‘for-loop’ statement in AnyScript like C++ language?
In C++ STL(Standard Template Library), there are some containers like Vector, List, Map and so on.
For instance, it would be very useful if there can be a container like std:vector<AnyVec3>.
Then AnyScript user can access to the individual element of the container by index.
So I’d like to know whether there are some containers in AnyScript like C++ STL.
And, if not, would you have some plans to implement those things in AnyScript?
There is no for loop available in AnyBody, the thing which comes closest is a parameter study, this will allow you to run a sequence of analysis, but it will not allow you to construct multiple items in the script using a loop. This would be a nice feature to have.
It should be possible to construct a parameter study and then use the step index to access a certain quantity in a matrix or vector would this type of solution solve your problem?
In general the matrices and vectors can be accessed with an index, this is for example used in the definition of the forceplate classes available in the toolbox/mocap folder.
Yes, what I want is to construct multiple items in the AnyScript using the for-loop statement. I hope that this feature would be realized in the future.
In my code, ‘AnyVec3Container’ can contain the unlimited number of AnyVec3 instances. When this instance of container is created, the capacity of this container is unlimited because this container has the operator ‘push_back()’.
But in your code, when the instance of AnyMatrix was created, the dimension of the instance is determined when it is created. After that, user can’t change it. It means that we can’t change the size of ‘Matrix’.
I think that this kind of feature may be very useful if it can be used with the for-loop statement. In a for-loop, a lot of processes for creating instances repeatedly can be automated.
I hope that my reply may explain my original intention well.
Creating for loops in the script for creating the multiple objects may turn out to be very difficult, because it makes the parsing much more complicated, so at this moment i am unsure if we will attempt to do this.
If the implementation of the for-loop statement in the AnyScript may not be easy in near future, I think that your suggestion like ‘XXfunctionXX’ would be the best currently.
Additionally, I’d like to suggest that the function ‘XXfunctionXX’ would be better to extract any kind of object. For instance, not only to AnyVec3, but also AnyMat33 and so on.
If to do that, the function ‘XXfunctionXX’ should have more arguments like this.