Skip to content

Instantly share code, notes, and snippets.

@commy2
Last active February 24, 2019 01:02
Show Gist options
  • Save commy2/d0af36ba7b839eb8eb93874b08dcab2e to your computer and use it in GitHub Desktop.
Save commy2/d0af36ba7b839eb8eb93874b08dcab2e to your computer and use it in GitHub Desktop.
private _origSubarray = [0, 1, 2];
private _origArray = [_origSubarray];
private _refCopy = _origArray;
private _deepCopy = + _origArray;
private _flatCopy = [] + _origArray;
_origSubarray pushBack 4;
_origArray pushBack ["a", "b", "c"];
systemChat format ["Reference Copy: %1", _refCopy]; // [[0,1,2,4],["a","b","c"]]
systemChat format ["Deep Copy: %1", _deepCopy]; // [[0,1,2]]
systemChat format ["Flat Copy: %1", _flatCopy]; // [[0,1,2,4]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment