Skip to content

Commit 65db462

Browse files
authored
Update README.md
1 parent 5c39fd5 commit 65db462

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
[![Donate](https://img.shields.io/badge/donate-%E2%9D%A4-blue.svg)](https://musnik.itch.io/donate-me) [![License](https://img.shields.io/github/license/KeeVeeGames/DeepCopy.gml)](#!)
44

5+
This simple script lets you recursively deep copy nested arrays, structs and "class" instances. The syntax is pretty straightforward: `deep_copy(thing)` function will return a new instance of "thing" (new array, new anonymous struct or new "constructed" struct) with the same data and the respectful copies of all nested things.
56

7+
The method behind this is coming from my [finding](https://twitter.com/KeeVeeGames/status/1294268813807099905) of preserving struct's type / constructor. I also realized that I may create my own [serialization protocol](https://twitter.com/KeeVeeGames/status/1294988076553510912), but that will be released in future.
8+
9+
**Note:**
10+
* Copying ds'es won't deep copy them but pass them through as real numbers.<sup>✶</sup>
11+
* Be mindful about circular references, they will make the algorithm stuck in an infinite loop.<sup>✶</sup>
12+
* There is no way to mark a field to not be "copiable".<sup>✶</sup>
13+
* Copying function references is also not working: it will shallow copy the reference to the original method, as I am not aware of any way to deep copy functions.
14+
15+
<sup>✶</sup> — you may consider using DeepCopy+ and Protoclasses as a part of GMProto framework, that are solving the problem of deep cloning ds'es, preventing circular references, adding the way to mark fields "unserializable" and having better type checking (not currently released, [stay tuned](https://twitter.com/KeeVeeGames)).
616

717
## Installation:
818
Get the latest asset package from the [releases page](../../releases). Import it into IDE.

0 commit comments

Comments
 (0)