3DCoat Core API
The 3DCoat API documentation.
No Matches

 * Very basic arrays operations

// Very basic arrays operations
#include <CoreAPI.h>
//If you need the release build at full speed please change the Debug below to Release
//@config: Debug
//this function just displays the array using the coat::dialog
void show(coat::list<int>& list) {
coat::str res;
for (auto& a : list){
res << a << " ";
// The main() will be called as soon as user will run the script
int main(){
coat::list<int> array; // declare array of int-s
array.Add(1); // add the single integer value 1
array1.Add(2, 10); // add 10 elements, each element is 2
array1.Insert(3, 5); // insert the value 5 at position 3
array1.RemoveAt(5, 2); // remove 2 elements at the position 5
int x[3] = { 7,8,9 };
array1.AddRange(x, 3); // add 3 elements from the regular array
array.AddRange(array1); // add the whole array
array.Reverse(); // reverse the order of elements
int pos_of_2 = array1.find(2); // returns the position of the value 2, returns -1 if not found
for (int x : array) { // the for-cycle. In this case you may not erase array elements within the loop
//... do something ...
for (int i = 0; i < array.Count(); i++) { // indexed for-loop, in this case you can remove elements within the cycle
if (array[i] == 5) { // we remove element if it is exual to 5
array.Clear(); // set zero count of elements
array = array1; // you can assign one array to another one
[&](int x) {
// do something with each element
array1.Fill(7); // fill with the same value
return 0;
the rich dialog. You may customize it, show your custom parameters and custom buttons.
Definition CoreAPI.h:3609
dialog & ok()
add Ok button
int show()
pass the function/lambda that will be called when the button will be pressed. The button index (start...
dialog & text(const char *id)
pass the header text of the dialog
comms::cStr str
the string that is compatible with the 3DCoat engine, see the cStr
Definition CoreAPI.h:67
comms::cList< X > list
the array template, see cList
Definition CoreAPI.h:70