This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
script_syntax [2023/02/13 22:56] – justin | script_syntax [2023/02/13 23:09] – justin | ||
---|---|---|---|
Line 232: | Line 232: | ||
====Duplicate==== | ====Duplicate==== | ||
- | The **duplicate** function creates a unique copy of an [[array]] or [[codex]]. | + | The **duplicate** function creates a unique copy of an [[array]] or [[codex]]. |
+ | |||
+ | Using the code below, $items_copy will contain a reference to the original $items [[codex]], so any changes to one will affect the other. | ||
+ | <code bauxite> | ||
+ | $items = codex[" | ||
+ | $items_copy = $items; | ||
+ | $items_copy[" | ||
+ | </ | ||
+ | |||
+ | In the example below, a copy of $items is made using the " | ||
+ | <code bauxite> | ||
+ | $items = codex[" | ||
+ | $items_copy = duplicate($item_data); | ||
+ | $items_copy[" | ||
+ | </ | ||
====Inverse==== | ====Inverse==== |