michael.zhang Posted August 29, 2011 Posted August 29, 2011 Hello, Unigine Docs: Unigine Script lists a function called: void swap(variable v0, variable v1) int a [4] = (2, 3, 4, 5); //swap(a[0], a[1]); // Interpreter::parse(): unknown token "swap" int b = 4; int c = 5; swap(b,c); // Interpreter::parse(): unknown token "swap" for(int i= 0; i < a.size(); i++){ log.message(string(a[i])); } 1) Why is this token not known? 2) Is it okay if I swap elements of an array? Is it okay if the elements of the array are objects, as opposed to primitives? Foo foos [2]; foos[0] = new Foo(1); foos[1] = new Foo(2); swap(foos[0], foos[1]); // is this legal? Will it switch the Foos around in the vector?
Guest anet Posted August 30, 2011 Posted August 30, 2011 Hello, 1) Why is this token not known? Add #include <unigine.h>
michael.zhang Posted August 30, 2011 Author Posted August 30, 2011 Oh,... Never had to do that for any of the other functions listed in that documentation page. Thanks!
Recommended Posts