isaacscript-common 6.6.2 → 6.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/callbacks/postCustomDoorEnter.d.ts +1 -1
  2. package/dist/callbacks/postCustomDoorEnter.lua +1 -1
  3. package/dist/enums/private/SerializationBrand.d.ts +0 -4
  4. package/dist/enums/private/SerializationBrand.d.ts.map +1 -1
  5. package/dist/features/customStage/shadows.d.ts.map +1 -1
  6. package/dist/features/customStage/shadows.lua +0 -2
  7. package/dist/features/saveDataManager/merge.lua +4 -3
  8. package/dist/functions/array.d.ts.map +1 -1
  9. package/dist/functions/array.lua +1 -1
  10. package/dist/functions/deepCopy.d.ts +8 -5
  11. package/dist/functions/deepCopy.d.ts.map +1 -1
  12. package/dist/functions/deepCopy.lua +142 -38
  13. package/dist/functions/deepCopyTests.d.ts +6 -1
  14. package/dist/functions/deepCopyTests.d.ts.map +1 -1
  15. package/dist/functions/deepCopyTests.lua +19 -16
  16. package/dist/functions/log.d.ts +1 -1
  17. package/dist/functions/log.d.ts.map +1 -1
  18. package/dist/functions/log.lua +8 -4
  19. package/dist/functions/mergeTests.d.ts +7 -1
  20. package/dist/functions/mergeTests.d.ts.map +1 -1
  21. package/dist/functions/mergeTests.lua +86 -7
  22. package/dist/functions/playerIndex.d.ts +4 -0
  23. package/dist/functions/playerIndex.d.ts.map +1 -1
  24. package/dist/functions/playerIndex.lua +4 -0
  25. package/dist/functions/table.d.ts +1 -1
  26. package/dist/functions/table.lua +1 -1
  27. package/package.json +2 -2
  28. package/src/callbacks/postCursedTeleport.ts +1 -1
  29. package/src/callbacks/postCustomDoorEnter.ts +1 -1
  30. package/src/callbacks/postPlayerCollectible.ts +1 -1
  31. package/src/callbacks/postSacrifice.ts +1 -1
  32. package/src/enums/private/SerializationBrand.ts +0 -4
  33. package/src/features/customStage/shadows.ts +0 -6
  34. package/src/features/extraConsoleCommands/listCommands.ts +3 -3
  35. package/src/features/persistentEntities.ts +1 -1
  36. package/src/features/saveDataManager/merge.ts +3 -3
  37. package/src/functions/array.ts +5 -2
  38. package/src/functions/bitwise.ts +2 -2
  39. package/src/functions/deepCopy.ts +98 -19
  40. package/src/functions/deepCopyTests.ts +75 -19
  41. package/src/functions/log.ts +16 -7
  42. package/src/functions/mergeTests.ts +152 -4
  43. package/src/functions/playerIndex.ts +4 -0
  44. package/src/functions/table.ts +1 -1
  45. package/src/functions/trinketGive.ts +3 -3
  46. package/src/functions/tstlClass.ts +1 -1
  47. package/src/functions/ui.ts +3 -3
@@ -39,7 +39,7 @@ export declare function initCustomDoor(mod: ModUpgraded, effectVariant: EffectVa
39
39
  * The custom door is an `EntityEffect`. You can manually open or close the door by modifying its
40
40
  * state. (The values to use correspond to the `DoorState` enum.)
41
41
  *
42
- * This function will throw a runtime error if:
42
+ * This function will throw a run-time error if:
43
43
  * - the door slot already has a vanilla door
44
44
  * - the door slot already has a custom door
45
45
  * - the tile at the door slot does not have a wall
@@ -199,7 +199,7 @@ end
199
199
  -- The custom door is an `EntityEffect`. You can manually open or close the door by modifying its
200
200
  -- state. (The values to use correspond to the `DoorState` enum.)
201
201
  --
202
- -- This function will throw a runtime error if:
202
+ -- This function will throw a run-time error if:
203
203
  -- - the door slot already has a vanilla door
204
204
  -- - the door slot already has a custom door
205
205
  -- - the tile at the door slot does not have a wall
@@ -16,10 +16,6 @@ export declare enum SerializationBrand {
16
16
  /**
17
17
  * This is set to the value that represents the default value (instead of an empty string like the
18
18
  * other brands are).
19
- *
20
- * Default maps that use a factory function are unserializable, but do not throw runtime errors
21
- * because the merge function can derive the factory function from the already-instantiated
22
- * object.
23
19
  */
24
20
  DEFAULT_MAP_VALUE = "__TSTL_DEFAULT_MAP_VALUE",
25
21
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"SerializationBrand.d.ts","sourceRoot":"","sources":["../../../src/enums/private/SerializationBrand.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,kBAAkB;IAE5B,WAAW,uBAAuB;IAClC,GAAG,eAAe;IAClB,GAAG,eAAe;IAGlB,KAAK,YAAY;IACjB,OAAO,cAAc;IACrB,GAAG,UAAU;IACb,MAAM,aAAa;IAEnB;;;;;;;OAOG;IACH,iBAAiB,6BAA6B;IAE9C;;;;;;;;;;OAUG;IACH,uBAAuB,mCAAmC;CAC3D"}
1
+ {"version":3,"file":"SerializationBrand.d.ts","sourceRoot":"","sources":["../../../src/enums/private/SerializationBrand.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,kBAAkB;IAE5B,WAAW,uBAAuB;IAClC,GAAG,eAAe;IAClB,GAAG,eAAe;IAGlB,KAAK,YAAY;IACjB,OAAO,cAAc;IACrB,GAAG,UAAU;IACb,MAAM,aAAa;IAEnB;;;OAGG;IACH,iBAAiB,6BAA6B;IAE9C;;;;;;;;;;OAUG;IACH,uBAAuB,mCAAmC;CAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AA0C3D,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAqCzD"}
1
+ {"version":3,"file":"shadows.d.ts","sourceRoot":"","sources":["../../../src/features/customStage/shadows.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAoC3D,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,CAqCzD"}
@@ -35,8 +35,6 @@ local ROOM_SHAPE_TO_SHADOW_ANIMATION = {
35
35
  [RoomShape.LBR] = "2x2"
36
36
  }
37
37
  local FADED_BLACK = Color(0, 0, 0, 0.25)
38
- local shadowSprite = Sprite()
39
- shadowSprite:Load(ISAACSCRIPT_CUSTOM_STAGE_GFX_PATH .. "/stage-shadow.anm2", true)
40
38
  function ____exports.setShadows(self, customStage)
41
39
  if customStage.shadows == nil then
42
40
  return
@@ -1,6 +1,6 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Map = ____lualib.Map
3
2
  local Set = ____lualib.Set
3
+ local Map = ____lualib.Map
4
4
  local ____exports = {}
5
5
  local mergeArray, mergeTSTLObject, mergeTable
6
6
  local ____SerializationBrand = require("enums.private.SerializationBrand")
@@ -20,6 +20,7 @@ local ____table = require("functions.table")
20
20
  local clearTable = ____table.clearTable
21
21
  local iterateTableInOrder = ____table.iterateTableInOrder
22
22
  local ____tstlClass = require("functions.tstlClass")
23
+ local isDefaultMap = ____tstlClass.isDefaultMap
23
24
  local isTSTLMap = ____tstlClass.isTSTLMap
24
25
  local isTSTLSet = ____tstlClass.isTSTLSet
25
26
  local ____types = require("functions.types")
@@ -64,7 +65,7 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription)
64
65
  mergeArray(nil, oldObject, newTable)
65
66
  return
66
67
  end
67
- if isTSTLMap(nil, oldObject) or isTSTLSet(nil, oldObject) then
68
+ if isTSTLMap(nil, oldObject) or isTSTLSet(nil, oldObject) or isDefaultMap(nil, oldObject) then
68
69
  mergeTSTLObject(nil, oldObject, newTable, traversalDescription)
69
70
  else
70
71
  mergeTable(nil, oldObject, newTable, traversalDescription)
@@ -99,7 +100,7 @@ function mergeTSTLObject(self, oldObject, newTable, traversalDescription)
99
100
  end
100
101
  keyToUse = numberKey
101
102
  end
102
- if isTSTLMap(nil, oldObject) then
103
+ if isTSTLMap(nil, oldObject) or isDefaultMap(nil, oldObject) then
103
104
  local valueCopy
104
105
  if isTable(nil, value) then
105
106
  valueCopy = deepCopy(nil, value, SerializationType.DESERIALIZE, traversalDescription)
@@ -1 +1 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/functions/array.ts"],"names":[],"mappings":";;;AAKA;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,MAAM,EAAE,CAAC,EAAE,GAAG,SAAS,C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GAAG,MAAM,CAEpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAM3E"}
@@ -437,7 +437,7 @@ function ____exports.isArray(self, object)
437
437
  if not hasAllNumberKeys then
438
438
  return false
439
439
  end
440
- local tableLength = #object
440
+ local tableLength = #__TS__ObjectKeys(object)
441
441
  if tableLength == 0 then
442
442
  return true
443
443
  end
@@ -21,10 +21,13 @@ import { SerializationType } from "../enums/SerializationType";
21
21
  * - other Isaac API objects such as `EntityPtr` (that have a type of "userdata")
22
22
  *
23
23
  * @param value The primitive or object to copy.
24
- * @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
25
- * to Lua tables, or can deserialize Lua tables to objects. Default is
26
- * `SerializationType.NONE`.
27
- * @param traversalDescription Used to track the current key that we are operating on.
24
+ * @param serializationType Optional. Has 3 possible values. Can copy objects as-is, or can
25
+ * serialize objects to Lua tables, or can deserialize Lua tables to
26
+ * objects. Default is `SerializationType.NONE`.
27
+ * @param traversalDescription Optional. Used to track the current key that we are operating on.
28
+ * Default is an empty string.
29
+ * @param insideMap Optional. Tracks whether or not the deep copy function is in the process of
30
+ * recursively copying a TSTL Map. Default is false.
28
31
  */
29
- export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string): unknown;
32
+ export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string, insideMap?: boolean): unknown;
30
33
  //# sourceMappingURL=deepCopy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA4B/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,oBAAyB,EAC1C,oBAAoB,SAAK,GACxB,OAAO,CA6CT"}
1
+ {"version":3,"file":"deepCopy.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopy.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA4B/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,OAAO,EACd,iBAAiB,oBAAyB,EAC1C,oBAAoB,SAAK,EACzB,SAAS,UAAQ,GAChB,OAAO,CAkDT"}
@@ -66,17 +66,23 @@ local twoDimensionalSort = ____utils.twoDimensionalSort
66
66
  -- - other Isaac API objects such as `EntityPtr` (that have a type of "userdata")
67
67
  --
68
68
  -- @param value The primitive or object to copy.
69
- -- @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
70
- -- to Lua tables, or can deserialize Lua tables to objects. Default is
71
- -- `SerializationType.NONE`.
72
- -- @param traversalDescription Used to track the current key that we are operating on.
73
- function ____exports.deepCopy(self, value, serializationType, traversalDescription)
69
+ -- @param serializationType Optional. Has 3 possible values. Can copy objects as-is, or can
70
+ -- serialize objects to Lua tables, or can deserialize Lua tables to
71
+ -- objects. Default is `SerializationType.NONE`.
72
+ -- @param traversalDescription Optional. Used to track the current key that we are operating on.
73
+ -- Default is an empty string.
74
+ -- @param insideMap Optional. Tracks whether or not the deep copy function is in the process of
75
+ -- recursively copying a TSTL Map. Default is false.
76
+ function ____exports.deepCopy(self, value, serializationType, traversalDescription, insideMap)
74
77
  if serializationType == nil then
75
78
  serializationType = SerializationType.NONE
76
79
  end
77
80
  if traversalDescription == nil then
78
81
  traversalDescription = ""
79
82
  end
83
+ if insideMap == nil then
84
+ insideMap = false
85
+ end
80
86
  if SAVE_DATA_MANAGER_DEBUG then
81
87
  local logString = "deepCopy is operating on: " .. traversalDescription
82
88
  if serializationType == SerializationType.SERIALIZE then
@@ -109,7 +115,13 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
109
115
  if ____cond6 then
110
116
  do
111
117
  local luaTable = value
112
- return deepCopyTable(nil, luaTable, serializationType, traversalDescription)
118
+ return deepCopyTable(
119
+ nil,
120
+ luaTable,
121
+ serializationType,
122
+ traversalDescription,
123
+ insideMap
124
+ )
113
125
  end
114
126
  end
115
127
  ____cond6 = ____cond6 or ____switch6 == "userdata"
@@ -120,15 +132,33 @@ function ____exports.deepCopy(self, value, serializationType, traversalDescripti
120
132
  end
121
133
  until true
122
134
  end
123
- function deepCopyTable(self, luaTable, serializationType, traversalDescription)
135
+ function deepCopyTable(self, luaTable, serializationType, traversalDescription, insideMap)
124
136
  if isDefaultMap(nil, luaTable) or luaTable[SerializationBrand.DEFAULT_MAP] ~= nil then
125
- return deepCopyDefaultMap(nil, luaTable, serializationType, traversalDescription)
137
+ return deepCopyDefaultMap(
138
+ nil,
139
+ luaTable,
140
+ serializationType,
141
+ traversalDescription,
142
+ insideMap
143
+ )
126
144
  end
127
145
  if isTSTLMap(nil, luaTable) or luaTable[SerializationBrand.MAP] ~= nil then
128
- return deepCopyMap(nil, luaTable, serializationType, traversalDescription)
146
+ return deepCopyMap(
147
+ nil,
148
+ luaTable,
149
+ serializationType,
150
+ traversalDescription,
151
+ insideMap
152
+ )
129
153
  end
130
154
  if isTSTLSet(nil, luaTable) or luaTable[SerializationBrand.SET] ~= nil then
131
- return deepCopySet(nil, luaTable, serializationType, traversalDescription)
155
+ return deepCopySet(
156
+ nil,
157
+ luaTable,
158
+ serializationType,
159
+ traversalDescription,
160
+ insideMap
161
+ )
132
162
  end
133
163
  local className = getTSTLClassName(nil, luaTable)
134
164
  if className == "WeakMap" then
@@ -138,18 +168,36 @@ function deepCopyTable(self, luaTable, serializationType, traversalDescription)
138
168
  error("The deep copy function does not support copying the \"WeakSet\" class for: " .. traversalDescription)
139
169
  end
140
170
  if isUserDefinedTSTLClass(nil, luaTable) then
141
- return deepCopyTSTLClass(nil, luaTable, serializationType, traversalDescription)
171
+ return deepCopyTSTLClass(
172
+ nil,
173
+ luaTable,
174
+ serializationType,
175
+ traversalDescription,
176
+ insideMap
177
+ )
142
178
  end
143
179
  checkMetatable(nil, luaTable, traversalDescription)
144
180
  if isSerializedIsaacAPIClass(nil, luaTable) and serializationType == SerializationType.DESERIALIZE then
145
181
  return deserializeIsaacAPIClass(nil, luaTable)
146
182
  end
147
183
  if isArray(nil, luaTable) then
148
- return deepCopyArray(nil, luaTable, serializationType, traversalDescription)
149
- end
150
- return deepCopyNormalLuaTable(nil, luaTable, serializationType, traversalDescription)
184
+ return deepCopyArray(
185
+ nil,
186
+ luaTable,
187
+ serializationType,
188
+ traversalDescription,
189
+ insideMap
190
+ )
191
+ end
192
+ return deepCopyNormalLuaTable(
193
+ nil,
194
+ luaTable,
195
+ serializationType,
196
+ traversalDescription,
197
+ insideMap
198
+ )
151
199
  end
152
- function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription)
200
+ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescription, insideMap)
153
201
  local ____isDefaultMap_result_0
154
202
  if isDefaultMap(nil, defaultMap) then
155
203
  ____isDefaultMap_result_0 = defaultMap:getConstructorArg()
@@ -158,7 +206,17 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
158
206
  end
159
207
  local constructorArg = ____isDefaultMap_result_0
160
208
  if serializationType == SerializationType.SERIALIZE and not isPrimitive(nil, constructorArg) then
161
- return deepCopyMap(nil, defaultMap, serializationType, traversalDescription)
209
+ if insideMap then
210
+ error("Failed to deep copy a DefaultMap because it was instantiated with a factory function and was also inside of another map. You cannot use a nested DefaultMap in this way because factory functions are not serializable. (In other words, there is no way to copy the function that you are using for the DefaultMap into the \"save#.dat\" file.) Instead, refactor your data structure so that the DefaultMap is not nested.")
211
+ else
212
+ return deepCopyMap(
213
+ nil,
214
+ defaultMap,
215
+ serializationType,
216
+ traversalDescription,
217
+ insideMap
218
+ )
219
+ end
162
220
  end
163
221
  local newDefaultMap = getNewDefaultMap(
164
222
  nil,
@@ -167,7 +225,14 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
167
225
  traversalDescription,
168
226
  constructorArg
169
227
  )
170
- local ____getCopiedEntries_result_1 = getCopiedEntries(nil, defaultMap, serializationType, traversalDescription)
228
+ insideMap = true
229
+ local ____getCopiedEntries_result_1 = getCopiedEntries(
230
+ nil,
231
+ defaultMap,
232
+ serializationType,
233
+ traversalDescription,
234
+ insideMap
235
+ )
171
236
  local entries = ____getCopiedEntries_result_1.entries
172
237
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_1.convertedNumberKeysToStrings
173
238
  if convertedNumberKeysToStrings then
@@ -186,19 +251,20 @@ function deepCopyDefaultMap(self, defaultMap, serializationType, traversalDescri
186
251
  newDefaultMap[key] = value
187
252
  end
188
253
  end
254
+ insideMap = false
189
255
  return newDefaultMap
190
256
  end
191
257
  function getNewDefaultMap(self, defaultMap, serializationType, traversalDescription, constructorArg)
192
258
  repeat
193
- local ____switch31 = serializationType
194
- local ____cond31 = ____switch31 == SerializationType.NONE
195
- if ____cond31 then
259
+ local ____switch33 = serializationType
260
+ local ____cond33 = ____switch33 == SerializationType.NONE
261
+ if ____cond33 then
196
262
  do
197
263
  return __TS__New(DefaultMap, constructorArg)
198
264
  end
199
265
  end
200
- ____cond31 = ____cond31 or ____switch31 == SerializationType.SERIALIZE
201
- if ____cond31 then
266
+ ____cond33 = ____cond33 or ____switch33 == SerializationType.SERIALIZE
267
+ if ____cond33 then
202
268
  do
203
269
  local newDefaultMap = {}
204
270
  newDefaultMap[SerializationBrand.DEFAULT_MAP] = ""
@@ -206,8 +272,8 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
206
272
  return newDefaultMap
207
273
  end
208
274
  end
209
- ____cond31 = ____cond31 or ____switch31 == SerializationType.DESERIALIZE
210
- if ____cond31 then
275
+ ____cond33 = ____cond33 or ____switch33 == SerializationType.DESERIALIZE
276
+ if ____cond33 then
211
277
  do
212
278
  if isDefaultMap(nil, defaultMap) then
213
279
  error(("The deep copy function failed to deserialize a default map of \"" .. traversalDescription) .. "\", since it was not a Lua table.")
@@ -221,7 +287,7 @@ function getNewDefaultMap(self, defaultMap, serializationType, traversalDescript
221
287
  end
222
288
  until true
223
289
  end
224
- function deepCopyMap(self, map, serializationType, traversalDescription)
290
+ function deepCopyMap(self, map, serializationType, traversalDescription, insideMap)
225
291
  local newMap
226
292
  if serializationType == SerializationType.SERIALIZE then
227
293
  newMap = {}
@@ -229,7 +295,14 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
229
295
  else
230
296
  newMap = __TS__New(Map)
231
297
  end
232
- local ____getCopiedEntries_result_2 = getCopiedEntries(nil, map, serializationType, traversalDescription)
298
+ insideMap = true
299
+ local ____getCopiedEntries_result_2 = getCopiedEntries(
300
+ nil,
301
+ map,
302
+ serializationType,
303
+ traversalDescription,
304
+ insideMap
305
+ )
233
306
  local entries = ____getCopiedEntries_result_2.entries
234
307
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_2.convertedNumberKeysToStrings
235
308
  if convertedNumberKeysToStrings then
@@ -248,9 +321,10 @@ function deepCopyMap(self, map, serializationType, traversalDescription)
248
321
  newMap[key] = value
249
322
  end
250
323
  end
324
+ insideMap = false
251
325
  return newMap
252
326
  end
253
- function deepCopySet(self, set, serializationType, traversalDescription)
327
+ function deepCopySet(self, set, serializationType, traversalDescription, insideMap)
254
328
  local newSet
255
329
  if serializationType == SerializationType.SERIALIZE then
256
330
  newSet = {}
@@ -258,7 +332,13 @@ function deepCopySet(self, set, serializationType, traversalDescription)
258
332
  else
259
333
  newSet = __TS__New(Set)
260
334
  end
261
- local ____getCopiedEntries_result_3 = getCopiedEntries(nil, set, serializationType, traversalDescription)
335
+ local ____getCopiedEntries_result_3 = getCopiedEntries(
336
+ nil,
337
+ set,
338
+ serializationType,
339
+ traversalDescription,
340
+ insideMap
341
+ )
262
342
  local entries = ____getCopiedEntries_result_3.entries
263
343
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_3.convertedNumberKeysToStrings
264
344
  if convertedNumberKeysToStrings then
@@ -278,14 +358,20 @@ function deepCopySet(self, set, serializationType, traversalDescription)
278
358
  end
279
359
  return newSet
280
360
  end
281
- function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescription)
361
+ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescription, insideMap)
282
362
  local newClass
283
363
  if serializationType == SerializationType.SERIALIZE then
284
364
  newClass = {}
285
365
  else
286
366
  newClass = newTSTLClass(nil, tstlClass)
287
367
  end
288
- local ____getCopiedEntries_result_4 = getCopiedEntries(nil, tstlClass, serializationType, traversalDescription)
368
+ local ____getCopiedEntries_result_4 = getCopiedEntries(
369
+ nil,
370
+ tstlClass,
371
+ serializationType,
372
+ traversalDescription,
373
+ insideMap
374
+ )
289
375
  local entries = ____getCopiedEntries_result_4.entries
290
376
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_4.convertedNumberKeysToStrings
291
377
  if convertedNumberKeysToStrings then
@@ -298,17 +384,29 @@ function deepCopyTSTLClass(self, tstlClass, serializationType, traversalDescript
298
384
  end
299
385
  return newClass
300
386
  end
301
- function deepCopyArray(self, array, serializationType, traversalDescription)
387
+ function deepCopyArray(self, array, serializationType, traversalDescription, insideMap)
302
388
  local newArray = {}
303
389
  for ____, value in ipairs(array) do
304
- local newValue = ____exports.deepCopy(nil, value, serializationType, traversalDescription)
390
+ local newValue = ____exports.deepCopy(
391
+ nil,
392
+ value,
393
+ serializationType,
394
+ traversalDescription,
395
+ insideMap
396
+ )
305
397
  newArray[#newArray + 1] = newValue
306
398
  end
307
399
  return newArray
308
400
  end
309
- function deepCopyNormalLuaTable(self, luaTable, serializationType, traversalDescription)
401
+ function deepCopyNormalLuaTable(self, luaTable, serializationType, traversalDescription, insideMap)
310
402
  local newTable = {}
311
- local ____getCopiedEntries_result_5 = getCopiedEntries(nil, luaTable, serializationType, traversalDescription)
403
+ local ____getCopiedEntries_result_5 = getCopiedEntries(
404
+ nil,
405
+ luaTable,
406
+ serializationType,
407
+ traversalDescription,
408
+ insideMap
409
+ )
312
410
  local entries = ____getCopiedEntries_result_5.entries
313
411
  local convertedNumberKeysToStrings = ____getCopiedEntries_result_5.convertedNumberKeysToStrings
314
412
  if convertedNumberKeysToStrings then
@@ -321,7 +419,7 @@ function deepCopyNormalLuaTable(self, luaTable, serializationType, traversalDesc
321
419
  end
322
420
  return newTable
323
421
  end
324
- function getCopiedEntries(self, object, serializationType, traversalDescription)
422
+ function getCopiedEntries(self, object, serializationType, traversalDescription, insideMap)
325
423
  local entries = {}
326
424
  if isTSTLMap(nil, object) or isTSTLSet(nil, object) or isDefaultMap(nil, object) then
327
425
  for ____, ____value in __TS__Iterator(object:entries()) do
@@ -353,14 +451,20 @@ function getCopiedEntries(self, object, serializationType, traversalDescription)
353
451
  local value = ____value[2]
354
452
  do
355
453
  if isSerializationBrand(nil, key) then
356
- goto __continue78
454
+ goto __continue80
357
455
  end
358
456
  traversalDescription = getTraversalDescription(nil, key, traversalDescription)
359
- local newValue = ____exports.deepCopy(nil, value, serializationType, traversalDescription)
457
+ local newValue = ____exports.deepCopy(
458
+ nil,
459
+ value,
460
+ serializationType,
461
+ traversalDescription,
462
+ insideMap
463
+ )
360
464
  local keyToUse = convertNumberKeysToStrings and tostring(key) or key
361
465
  copiedEntries[#copiedEntries + 1] = {keyToUse, newValue}
362
466
  end
363
- ::__continue78::
467
+ ::__continue80::
364
468
  end
365
469
  return {entries = copiedEntries, convertedNumberKeysToStrings = convertNumberKeysToStrings}
366
470
  end
@@ -1,2 +1,7 @@
1
- export declare function deepCopyTests(): void;
1
+ /**
2
+ * Run the suite of tests that prove that the "deepCopy" helper function works properly.
3
+ *
4
+ * This function is only useful if you are troubleshooting the "deepCopy" function.
5
+ */
6
+ export declare function runDeepCopyTests(): void;
2
7
  //# sourceMappingURL=deepCopyTests.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deepCopyTests.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopyTests.ts"],"names":[],"mappings":"AASA,wBAAgB,aAAa,IAAI,IAAI,CAqBpC"}
1
+ {"version":3,"file":"deepCopyTests.d.ts","sourceRoot":"","sources":["../../src/functions/deepCopyTests.ts"],"names":[],"mappings":"AASA;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAqBvC"}
@@ -27,7 +27,7 @@ local isString = ____types.isString
27
27
  local isTable = ____types.isTable
28
28
  function copiedObjectIsTable(self)
29
29
  local oldObject = {abc = "def"}
30
- local newObject = deepCopy(nil, oldObject)
30
+ local newObject = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectIsTable")
31
31
  if not isTable(nil, newObject) then
32
32
  error("The copied object had a type of: " .. __TS__TypeOf(newObject))
33
33
  end
@@ -36,7 +36,7 @@ function copiedObjectHasKeyAndValueString(self)
36
36
  local keyToLookFor = "abc"
37
37
  local valueToLookFor = "def"
38
38
  local oldObject = {abc = valueToLookFor}
39
- local newTable = deepCopy(nil, oldObject)
39
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasKeyAndValueString")
40
40
  local newObject = newTable
41
41
  local value = newObject[keyToLookFor]
42
42
  if value == nil then
@@ -54,7 +54,7 @@ function copiedTableHasKeyAndValueNumber(self)
54
54
  local valueToLookFor = 456
55
55
  local oldTable = {}
56
56
  oldTable[keyToLookFor] = valueToLookFor
57
- local newObject = deepCopy(nil, oldTable)
57
+ local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableHasKeyAndValueNumber")
58
58
  local newTable = newObject
59
59
  local value = newTable[keyToLookFor]
60
60
  if value == nil then
@@ -72,7 +72,7 @@ function copiedTableDoesNotCoerceTypes(self)
72
72
  local valueToLookFor = 456
73
73
  local oldTable = {}
74
74
  oldTable[keyToLookFor] = valueToLookFor
75
- local newObject = deepCopy(nil, oldTable)
75
+ local newObject = deepCopy(nil, oldTable, SerializationType.NONE, "copiedTableDoesNotCoerceTypes")
76
76
  local newTable = newObject
77
77
  local keyString = tostring(keyToLookFor)
78
78
  local valueString = tostring(valueToLookFor)
@@ -89,7 +89,7 @@ function copiedObjectHasNoReferencesForPrimitivesForward(self)
89
89
  local originalStringValue = "abcdef"
90
90
  local originalNumberValue = 123
91
91
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
92
- local newTable = deepCopy(nil, oldObject)
92
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesForward")
93
93
  local newObject = newTable
94
94
  oldObject.abc = "newValue"
95
95
  if oldObject.abc == newObject.abc then
@@ -104,7 +104,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
104
104
  local originalStringValue = "abcdef"
105
105
  local originalNumberValue = 123
106
106
  local oldObject = {abc = originalStringValue, def = originalNumberValue}
107
- local newTable = deepCopy(nil, oldObject)
107
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForPrimitivesBackward")
108
108
  local newObject = newTable
109
109
  newObject.abc = "newValue"
110
110
  if newObject.abc == oldObject.abc then
@@ -117,7 +117,7 @@ function copiedObjectHasNoReferencesForPrimitivesBackward(self)
117
117
  end
118
118
  function copiedObjectHasNoReferencesForArray(self)
119
119
  local oldObject = {abc = {1, 2, 3}}
120
- local newTable = deepCopy(nil, oldObject)
120
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasNoReferencesForArray")
121
121
  local newObject = newTable
122
122
  if oldObject.abc == newObject.abc then
123
123
  error("The copied object has the same point to the child array.")
@@ -145,7 +145,7 @@ function copiedObjectHasChildObject(self)
145
145
  local keyToLookFor = "def"
146
146
  local valueToLookFor = "ghi"
147
147
  local oldObject = {abc = {def = valueToLookFor}}
148
- local newTable = deepCopy(nil, oldObject)
148
+ local newTable = deepCopy(nil, oldObject, SerializationType.NONE, "copiedObjectHasChildObject")
149
149
  local newObject = newTable
150
150
  local childObject = newObject[childObjectIndex]
151
151
  if childObject == nil then
@@ -170,7 +170,7 @@ function copiedMapIsMap(self)
170
170
  local valueToLookFor = "def"
171
171
  local oldMap = __TS__New(Map)
172
172
  oldMap:set(keyToLookFor, valueToLookFor)
173
- local newObject = deepCopy(nil, oldMap)
173
+ local newObject = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapIsMap")
174
174
  local newMap = newObject
175
175
  if not isTable(nil, newMap) then
176
176
  error("The copied Map had a type of: " .. __TS__TypeOf(newMap))
@@ -184,7 +184,7 @@ function copiedMapHasValue(self)
184
184
  local valueToLookFor = "def"
185
185
  local oldMap = __TS__New(Map)
186
186
  oldMap:set(keyToLookFor, valueToLookFor)
187
- local newTable = deepCopy(nil, oldMap)
187
+ local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasValue")
188
188
  local newMap = newTable
189
189
  local value = newMap:get(keyToLookFor)
190
190
  if value == nil then
@@ -198,7 +198,7 @@ function copiedSetIsSet(self)
198
198
  local valueToLookFor = "abc"
199
199
  local oldSet = __TS__New(Set)
200
200
  oldSet:add(valueToLookFor)
201
- local newTable = deepCopy(nil, oldSet)
201
+ local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetIsSet")
202
202
  local newSet = newTable
203
203
  if not isTable(nil, newSet) then
204
204
  error("The copied Set had a type of: " .. __TS__TypeOf(newSet))
@@ -211,7 +211,7 @@ function copiedSetHasValue(self)
211
211
  local valueToLookFor = "abc"
212
212
  local oldSet = __TS__New(Set)
213
213
  oldSet:add(valueToLookFor)
214
- local newTable = deepCopy(nil, oldSet)
214
+ local newTable = deepCopy(nil, oldSet, SerializationType.NONE, "copiedSetHasValue")
215
215
  local newSet = newTable
216
216
  local hasValue = newSet:has(valueToLookFor)
217
217
  if not hasValue then
@@ -226,7 +226,7 @@ function copiedMapHasChildMap(self)
226
226
  local keyToLookFor = "abc"
227
227
  local oldMap = __TS__New(Map)
228
228
  oldMap:set(keyToLookFor, oldChildMap)
229
- local newTable = deepCopy(nil, oldMap)
229
+ local newTable = deepCopy(nil, oldMap, SerializationType.NONE, "copiedMapHasChildMap")
230
230
  local newMap = newTable
231
231
  local newChildMap = newMap:get(keyToLookFor)
232
232
  if newChildMap == nil then
@@ -259,7 +259,7 @@ function copiedDefaultMapHasChildDefaultMap(self)
259
259
  local oldChildMap = oldParentMap:getAndSetDefault(parentMapKey)
260
260
  oldChildMap:getAndSetDefault(childMapKey1)
261
261
  oldChildMap:set(childMapKey2, childMapCustomValue)
262
- local newTable = deepCopy(nil, oldParentMap)
262
+ local newTable = deepCopy(nil, oldParentMap, SerializationType.NONE, "copiedDefaultMapHasChildDefaultMap")
263
263
  local newParentMap = newTable
264
264
  local newChildMap = newParentMap:get(parentMapKey)
265
265
  if newChildMap == nil then
@@ -289,12 +289,15 @@ end
289
289
  function copiedDefaultMapHasBrand(self)
290
290
  local oldDefaultValue = "foo"
291
291
  local oldDefaultMap = __TS__New(DefaultMap, oldDefaultValue)
292
- local newTable = deepCopy(nil, oldDefaultMap, SerializationType.SERIALIZE)
292
+ local newTable = deepCopy(nil, oldDefaultMap, SerializationType.SERIALIZE, "copiedDefaultMapHasBrand")
293
293
  if not (newTable[SerializationBrand.DEFAULT_MAP] ~= nil) then
294
294
  error("The copied DefaultMap does not have the brand: " .. SerializationBrand.DEFAULT_MAP)
295
295
  end
296
296
  end
297
- function ____exports.deepCopyTests(self)
297
+ --- Run the suite of tests that prove that the "deepCopy" helper function works properly.
298
+ --
299
+ -- This function is only useful if you are troubleshooting the "deepCopy" function.
300
+ function ____exports.runDeepCopyTests(self)
298
301
  copiedObjectIsTable(nil)
299
302
  copiedObjectHasKeyAndValueString(nil)
300
303
  copiedTableHasKeyAndValueNumber(nil)
@@ -64,7 +64,7 @@ export declare function logSounds(this: void): void;
64
64
  * recursively call itself if it counters a table within a table.
65
65
  *
66
66
  * This function will only work on tables that have string keys (because it logs the keys in order,
67
- * instead of randomly). It will throw a runtime error if it encounters a non-string key.
67
+ * instead of randomly). It will throw a run-time error if it encounters a non-string key.
68
68
  */
69
69
  export declare function logTable(this: void, luaTable: unknown, parentTables?: number): void;
70
70
  /**