ID:2862757
 
Not a bug
BYOND Version:514
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 111.0.0.0
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Nested associative lists appears to be copied when using Copy() but all changes to the new list also affect the old list.
Numbered Steps to Reproduce Problem:
1. Create a nested associative list
2. Copy the first list into a second list.
3. Increment the copied second list.
4. Check first list, see that it has changed.
Code Snippet (if applicable) to Reproduce Problem:
var/testassoc[]=list("one" = list("a" = 1, "b" = 2, "c" = 3, "d" = 4), "two" = list("e" = 5, "f" = 6))

mob/verb/testcopy()
var/assoc[]=testassoc.Copy()
usr << "----ORIGINAL LIST----"
for(var/a in testassoc)
for(var/b in testassoc[a])
usr << "[b] = [testassoc[a][b]]"

usr << "----COPY LIST----"
for(var/a in assoc)
for(var/b in assoc[a])
assoc[a][b] ++
usr << "[b] = [assoc[a][b]]"

usr << "----ORIGINAL LIST AFTER COPY----"
for(var/a in testassoc)
for(var/b in testassoc[a])
usr << "[b] = [testassoc[a][b]]"


Expected Results:
Old list remains the same, copied list's values are incremented by one.
Actual Results:
Both lists are incremented.
Does the problem occur:
Everytime. This occurs whenever you trying to set testassoc[a][b] to a value, even if trying to set it directly.

It also occurs when modifying the above to be
var/list/assoc = list()
assoc = testassoc.Copy()

When does the problem NOT occur?
Seemingly never.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

This occurs in both Stable & Beta latest. Seemingly always occurs.

Copy() is a shallow copy.
Lummox JR resolved issue (Not a bug)