Commit Graph

3 Commits

Author SHA1 Message Date
David Briscoe
d48d4b0e81 table: Rewrite *_copy to copy any kind of type
Allowing shallow_copy/deep_copy to accept any type makes it easier to
write generic code where you just want to copy some input without
knowing anything about it. Like an event system, save system, etc.

Add corresponding test.

Tests pass
2022-03-03 22:03:12 -08:00
David Briscoe
5fa80ca97c tablex: Add deep & shallow for copy, overlay
Replace copy with shallow_copy, deep_copy.
Replace overlay with shallow_overlay, deep_overlay.

Significant rewrite of these functions and their semantics to update to
the note above them.

Add corresponding tests.
2022-03-03 10:04:28 -08:00
David Briscoe
5b4d1c16c5 tablex: Skip equality comparison in equal fn
The second loop doesn't care if the values are equal. It only checks if
the keys are there. The first loop already checked for equality.

Add tests to prove correctness using testy.lua.
2022-03-03 10:04:28 -08:00