Get array by value
-
Is there a way to pass an array by value instead of by reference?
This example prints the value
50
to the console, but I want it to print1
.const var arr = [1, 2, 3, 4, 5] reg t = arr; t[0] = 50; Console.print(arr[0]);
-
Well I found a solution but it makes me feel dirty :)
inline function getByValue(a) { local s = a.join(","); return s.split(","); }
-
I found a less dirty solution :)
newArray = oldArray.clone();