About Pi Downloads Documentation Plugins Developer Forum Issues

pi.util.Array.clone

Summary

Duplicates the array.

Syntax

pi.util.Array.clone(array,shallow (Optional))
  • Undeep is a required boolean value indicating whether the clone is a shallow clone or not

Usage Example

>>> var a = [3,5,[7]];
>>> a.clone();
[3,5,[7]];
>>> var b = pi.util.Array.clone(a);
>>> b[0]=9;
>>> b[2].push("hello");
>>> b
[9,5,[7,"hello"]]
>>> a
[3,5,[7]];

See Also