isaacscript-common 1.2.170 → 1.2.173

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.
@@ -1,11 +1,13 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  local ____exports = {}
3
- local hasSubscriptions, postNewRoom, preEntitySpawn, checkRoomChanged, currentRoomTopLeftWallPtrHash
3
+ local hasSubscriptions, postNewRoom, preEntitySpawn, checkRoomChanged, currentRoomTopLeftWallPtrHash, currentRoomTopLeftWallPtrHash2
4
4
  local ____cachedClasses = require("cachedClasses")
5
5
  local game = ____cachedClasses.game
6
6
  local ____gridEntity = require("functions.gridEntity")
7
7
  local getTopLeftWallGridIndex = ____gridEntity.getTopLeftWallGridIndex
8
8
  local spawnGridEntity = ____gridEntity.spawnGridEntity
9
+ local ____log = require("functions.log")
10
+ local log = ____log.log
9
11
  local ____postNewRoomEarly = require("callbacks.subscriptions.postNewRoomEarly")
10
12
  local postNewRoomEarlyFire = ____postNewRoomEarly.postNewRoomEarlyFire
11
13
  local postNewRoomEarlyHasSubscriptions = ____postNewRoomEarly.postNewRoomEarlyHasSubscriptions
@@ -31,16 +33,31 @@ function checkRoomChanged(self)
31
33
  if topLeftWall == nil then
32
34
  topLeftWall = spawnGridEntity(nil, GridEntityType.GRID_WALL, topLeftWallGridIndex)
33
35
  if topLeftWall == nil then
36
+ log("Error: Failed to spawn a new wall (1) for the PostNewRoomEarly callback.")
34
37
  return
35
38
  end
39
+ log("Spawned a new wall (1) for the PostNewRoomEarly callback.")
40
+ end
41
+ local rightOfTopWallGridIndex = topLeftWallGridIndex + 1
42
+ local topLeftWall2 = room:GetGridEntity(rightOfTopWallGridIndex)
43
+ if topLeftWall2 == nil then
44
+ topLeftWall2 = spawnGridEntity(nil, GridEntityType.GRID_WALL, rightOfTopWallGridIndex)
45
+ if topLeftWall2 == nil then
46
+ log("Error: Failed to spawn a new wall (2) for the PostNewRoomEarly callback.")
47
+ return
48
+ end
49
+ log("Spawned a new wall (2) for the PostNewRoomEarly callback.")
36
50
  end
37
51
  local topLeftWallPtrHash = GetPtrHash(topLeftWall)
38
- if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash then
52
+ local topLeftWallPtrHash2 = GetPtrHash(topLeftWall2)
53
+ if topLeftWallPtrHash ~= currentRoomTopLeftWallPtrHash or topLeftWallPtrHash2 ~= currentRoomTopLeftWallPtrHash2 then
39
54
  currentRoomTopLeftWallPtrHash = topLeftWallPtrHash
55
+ currentRoomTopLeftWallPtrHash2 = topLeftWallPtrHash2
40
56
  postNewRoomEarlyFire(nil)
41
57
  end
42
58
  end
43
59
  currentRoomTopLeftWallPtrHash = nil
60
+ currentRoomTopLeftWallPtrHash2 = nil
44
61
  function ____exports.postNewRoomEarlyCallbackInit(self, mod)
45
62
  mod:AddCallback(ModCallbacks.MC_POST_NEW_ROOM, postNewRoom)
46
63
  mod:AddCallback(ModCallbacks.MC_PRE_ENTITY_SPAWN, preEntitySpawn)
@@ -0,0 +1,5 @@
1
+ export declare enum SerializationType {
2
+ NONE = 0,
3
+ SERIALIZE = 1,
4
+ DESERIALIZE = 2
5
+ }
@@ -0,0 +1,10 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ ____exports.SerializationType = SerializationType or ({})
4
+ ____exports.SerializationType.NONE = 0
5
+ ____exports.SerializationType[____exports.SerializationType.NONE] = "NONE"
6
+ ____exports.SerializationType.SERIALIZE = 1
7
+ ____exports.SerializationType[____exports.SerializationType.SERIALIZE] = "SERIALIZE"
8
+ ____exports.SerializationType.DESERIALIZE = 2
9
+ ____exports.SerializationType[____exports.SerializationType.DESERIALIZE] = "DESERIALIZE"
10
+ return ____exports
@@ -3,11 +3,12 @@ local ____lualib = require("lualib_bundle")
3
3
  local Map = ____lualib.Map
4
4
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
5
5
  local ____exports = {}
6
+ local ____SerializationType = require("enums.SerializationType")
7
+ local SerializationType = ____SerializationType.SerializationType
6
8
  local ____featuresInitialized = require("featuresInitialized")
7
9
  local errorIfFeaturesNotInitialized = ____featuresInitialized.errorIfFeaturesNotInitialized
8
10
  local ____deepCopy = require("functions.deepCopy")
9
11
  local deepCopy = ____deepCopy.deepCopy
10
- local SerializationType = ____deepCopy.SerializationType
11
12
  local ____constants = require("features.saveDataManager.constants")
12
13
  local SAVE_DATA_MANAGER_FEATURE_NAME = ____constants.SAVE_DATA_MANAGER_FEATURE_NAME
13
14
  local ____main = require("features.saveDataManager.main")
@@ -9,9 +9,10 @@ local ____ModCallbacksCustom = require("enums.ModCallbacksCustom")
9
9
  local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
10
10
  local ____SaveDataKeys = require("enums.private.SaveDataKeys")
11
11
  local SaveDataKeys = ____SaveDataKeys.SaveDataKeys
12
+ local ____SerializationType = require("enums.SerializationType")
13
+ local SerializationType = ____SerializationType.SerializationType
12
14
  local ____deepCopy = require("functions.deepCopy")
13
15
  local deepCopy = ____deepCopy.deepCopy
14
- local SerializationType = ____deepCopy.SerializationType
15
16
  local ____log = require("functions.log")
16
17
  local log = ____log.log
17
18
  local ____table = require("functions.table")
@@ -8,6 +8,8 @@ local mergeArray, mergeTSTLObject, mergeTable, mergeVector
8
8
  local ____SerializationBrand = require("enums.private.SerializationBrand")
9
9
  local isSerializationBrand = ____SerializationBrand.isSerializationBrand
10
10
  local SerializationBrand = ____SerializationBrand.SerializationBrand
11
+ local ____SerializationType = require("enums.SerializationType")
12
+ local SerializationType = ____SerializationType.SerializationType
11
13
  local ____array = require("functions.array")
12
14
  local isArray = ____array.isArray
13
15
  local ____deepCopy = require("functions.deepCopy")
@@ -15,7 +17,6 @@ local addTraversalDescription = ____deepCopy.addTraversalDescription
15
17
  local deepCopy = ____deepCopy.deepCopy
16
18
  local deserializeVector = ____deepCopy.deserializeVector
17
19
  local isSerializedVector = ____deepCopy.isSerializedVector
18
- local SerializationType = ____deepCopy.SerializationType
19
20
  local ____log = require("functions.log")
20
21
  local log = ____log.log
21
22
  local ____table = require("functions.table")
@@ -23,6 +24,9 @@ local clearTable = ____table.clearTable
23
24
  local ____constants = require("features.saveDataManager.constants")
24
25
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
25
26
  function ____exports.merge(self, oldObject, newTable, traversalDescription)
27
+ if SAVE_DATA_MANAGER_DEBUG then
28
+ log("merge is operating on: " .. traversalDescription)
29
+ end
26
30
  local oldObjectType = type(oldObject)
27
31
  if oldObjectType ~= "table" then
28
32
  error("The first argument given to the merge function is not a table.")
@@ -31,9 +35,6 @@ function ____exports.merge(self, oldObject, newTable, traversalDescription)
31
35
  if newTableType ~= "table" then
32
36
  error("The second argument given to the merge function is not a table.")
33
37
  end
34
- if SAVE_DATA_MANAGER_DEBUG then
35
- log("merge is operating on: " .. traversalDescription)
36
- end
37
38
  if mergeArray(nil, oldObject, newTable) then
38
39
  return
39
40
  end
@@ -87,22 +88,30 @@ function mergeTSTLObject(self, oldObject, newTable, traversalDescription)
87
88
  end
88
89
  end
89
90
  function mergeTable(self, oldTable, newTable, traversalDescription)
91
+ if SAVE_DATA_MANAGER_DEBUG then
92
+ log("merge is operating on a table. Iterating through the keys...")
93
+ end
90
94
  for key, value in pairs(newTable) do
91
95
  do
96
+ if SAVE_DATA_MANAGER_DEBUG then
97
+ log((("merge is operating on: " .. tostring(key)) .. " --> ") .. tostring(value))
98
+ end
92
99
  if isSerializationBrand(nil, key) then
93
- goto __continue22
100
+ goto __continue23
94
101
  end
95
102
  if mergeVector(nil, oldTable, key, value) then
96
- goto __continue22
103
+ goto __continue23
97
104
  end
98
105
  local valueType = type(value)
99
106
  if valueType == "table" then
100
107
  local oldValue = oldTable[key]
101
108
  local oldValueType = type(oldValue)
102
- if oldValueType == "table" then
103
- traversalDescription = addTraversalDescription(nil, key, traversalDescription)
104
- ____exports.merge(nil, oldValue, value, traversalDescription)
109
+ if oldValueType ~= "table" then
110
+ oldValue = {}
111
+ oldTable[key] = oldValue
105
112
  end
113
+ traversalDescription = addTraversalDescription(nil, key, traversalDescription)
114
+ ____exports.merge(nil, oldValue, value, traversalDescription)
106
115
  else
107
116
  if SAVE_DATA_MANAGER_DEBUG then
108
117
  log((("Merging key \"" .. tostring(key)) .. "\" with value: ") .. tostring(value))
@@ -110,7 +119,7 @@ function mergeTable(self, oldTable, newTable, traversalDescription)
110
119
  oldTable[key] = value
111
120
  end
112
121
  end
113
- ::__continue22::
122
+ ::__continue23::
114
123
  end
115
124
  end
116
125
  function mergeVector(self, oldTable, key, value)
@@ -4,9 +4,10 @@ local Map = ____lualib.Map
4
4
  local __TS__ObjectKeys = ____lualib.__TS__ObjectKeys
5
5
  local ____exports = {}
6
6
  local getAllSaveDataToWriteToDisk
7
+ local ____SerializationType = require("enums.SerializationType")
8
+ local SerializationType = ____SerializationType.SerializationType
7
9
  local ____deepCopy = require("functions.deepCopy")
8
10
  local deepCopy = ____deepCopy.deepCopy
9
- local SerializationType = ____deepCopy.SerializationType
10
11
  local ____jsonHelpers = require("functions.jsonHelpers")
11
12
  local jsonEncode = ____jsonHelpers.jsonEncode
12
13
  local ____log = require("functions.log")
@@ -1,10 +1,6 @@
1
1
  /// <reference types="typescript-to-lua/language-extensions" />
2
2
  /// <reference types="isaac-typescript-definitions" />
3
- export declare enum SerializationType {
4
- NONE = 0,
5
- SERIALIZE = 1,
6
- DESERIALIZE = 2
7
- }
3
+ import { SerializationType } from "../enums/SerializationType";
8
4
  /**
9
5
  * deepCopy is a semi-generic deep cloner. It will recursively copy all of the values so that none
10
6
  * of the nested references remain.
@@ -12,6 +12,8 @@ local DefaultMap = ____DefaultMap.DefaultMap
12
12
  local ____SerializationBrand = require("enums.private.SerializationBrand")
13
13
  local isSerializationBrand = ____SerializationBrand.isSerializationBrand
14
14
  local SerializationBrand = ____SerializationBrand.SerializationBrand
15
+ local ____SerializationType = require("enums.SerializationType")
16
+ local SerializationType = ____SerializationType.SerializationType
15
17
  local ____constants = require("features.saveDataManager.constants")
16
18
  local SAVE_DATA_MANAGER_DEBUG = ____constants.SAVE_DATA_MANAGER_DEBUG
17
19
  local ____log = require("functions.log")
@@ -20,24 +22,24 @@ local ____vector = require("functions.vector")
20
22
  local isVector = ____vector.isVector
21
23
  function ____exports.deepCopy(self, oldObject, serializationType, traversalDescription)
22
24
  if serializationType == nil then
23
- serializationType = ____exports.SerializationType.NONE
25
+ serializationType = SerializationType.NONE
24
26
  end
25
27
  if traversalDescription == nil then
26
28
  traversalDescription = ""
27
29
  end
28
- local oldObjectType = type(oldObject)
29
- if oldObjectType ~= "table" then
30
- error(("The deepCopy function was given a " .. oldObjectType) .. " instead of a table.")
31
- end
32
30
  if SAVE_DATA_MANAGER_DEBUG then
33
31
  local logString = "deepCopy is operating on: " .. traversalDescription
34
- if serializationType == ____exports.SerializationType.SERIALIZE then
32
+ if serializationType == SerializationType.SERIALIZE then
35
33
  logString = logString .. " (serializing)"
36
- elseif serializationType == ____exports.SerializationType.DESERIALIZE then
34
+ elseif serializationType == SerializationType.DESERIALIZE then
37
35
  logString = logString .. " (deserializing)"
38
36
  end
39
37
  log(logString)
40
38
  end
39
+ local oldObjectType = type(oldObject)
40
+ if oldObjectType ~= "table" then
41
+ error(("The deepCopy function was given a " .. oldObjectType) .. " instead of a table.")
42
+ end
41
43
  local oldTable = oldObject
42
44
  local isClass = isTSTLClass(nil, oldTable)
43
45
  local hasTSTLDefaultMapBrand = false
@@ -52,27 +54,27 @@ function ____exports.deepCopy(self, oldObject, serializationType, traversalDescr
52
54
  hasTSTLClassBrand = oldTable[SerializationBrand.CLASS] ~= nil
53
55
  end
54
56
  local newObject
55
- if serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, DefaultMap) then
57
+ if serializationType == SerializationType.NONE and __TS__InstanceOf(oldObject, DefaultMap) then
56
58
  local oldDefaultMap = oldObject
57
59
  local constructorArg = oldDefaultMap:getConstructorArg()
58
60
  newObject = __TS__New(DefaultMap, constructorArg)
59
- elseif serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLDefaultMapBrand then
61
+ elseif serializationType == SerializationType.DESERIALIZE and hasTSTLDefaultMapBrand then
60
62
  local defaultValue = oldTable[SerializationBrand.DEFAULT_MAP_VALUE]
61
63
  if type(defaultValue) ~= "boolean" and type(defaultValue) ~= "number" and type(defaultValue) ~= "string" then
62
64
  error("The deepCopy function failed to get a valid default value for a DefaultMap object when deserializing.")
63
65
  else
64
66
  newObject = __TS__New(DefaultMap, defaultValue)
65
67
  end
66
- elseif serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, Map) or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLMapBrand then
68
+ elseif serializationType == SerializationType.NONE and __TS__InstanceOf(oldObject, Map) or serializationType == SerializationType.DESERIALIZE and hasTSTLMapBrand then
67
69
  newObject = __TS__New(Map)
68
- elseif serializationType == ____exports.SerializationType.NONE and __TS__InstanceOf(oldObject, Set) or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLSetBrand then
70
+ elseif serializationType == SerializationType.NONE and __TS__InstanceOf(oldObject, Set) or serializationType == SerializationType.DESERIALIZE and hasTSTLSetBrand then
69
71
  newObject = __TS__New(Set)
70
- elseif serializationType == ____exports.SerializationType.NONE and isClass or serializationType == ____exports.SerializationType.DESERIALIZE and hasTSTLClassBrand then
72
+ elseif serializationType == SerializationType.NONE and isClass or serializationType == SerializationType.DESERIALIZE and hasTSTLClassBrand then
71
73
  newObject = copyClass(nil, oldObject)
72
74
  else
73
75
  newObject = {}
74
76
  end
75
- if serializationType == ____exports.SerializationType.SERIALIZE then
77
+ if serializationType == SerializationType.SERIALIZE then
76
78
  local newTable = newObject
77
79
  if __TS__InstanceOf(oldObject, DefaultMap) then
78
80
  newTable[SerializationBrand.DEFAULT_MAP] = ""
@@ -189,7 +191,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
189
191
  local convertNumberKeysToString = false
190
192
  local isTSTLObject = __TS__InstanceOf(oldObject, Map) or __TS__InstanceOf(oldObject, Set)
191
193
  local keyType = type(key)
192
- if serializationType == ____exports.SerializationType.SERIALIZE and isTSTLObject and keyType == "number" then
194
+ if serializationType == SerializationType.SERIALIZE and isTSTLObject and keyType == "number" then
193
195
  convertNumberKeysToString = true
194
196
  local newTable = newObject
195
197
  newTable[SerializationBrand.OBJECT_WITH_NUMBER_KEYS] = ""
@@ -201,7 +203,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
201
203
  if isVector(nil, value) then
202
204
  local vector = value
203
205
  newValue = copyVector(nil, vector, serializationType)
204
- elseif ____exports.isSerializedVector(nil, value) and serializationType == ____exports.SerializationType.DESERIALIZE then
206
+ elseif ____exports.isSerializedVector(nil, value) and serializationType == SerializationType.DESERIALIZE then
205
207
  local serializedVector = value
206
208
  newValue = ____exports.deserializeVector(nil, serializedVector)
207
209
  elseif valueType == "table" then
@@ -221,7 +223,7 @@ function deepCopyValue(self, oldObject, newObject, key, value, traversalDescript
221
223
  end
222
224
  end
223
225
  function copyVector(self, vector, serializationType)
224
- if serializationType == ____exports.SerializationType.SERIALIZE then
226
+ if serializationType == SerializationType.SERIALIZE then
225
227
  local vectorTable = {}
226
228
  vectorTable.X = vector.X
227
229
  vectorTable.Y = vector.Y
@@ -275,12 +277,5 @@ function ____exports.isSerializedVector(self, object)
275
277
  local ____table = object
276
278
  return ____table[SerializationBrand.VECTOR] ~= nil and ____table.X ~= nil and ____table.Y ~= nil
277
279
  end
278
- ____exports.SerializationType = SerializationType or ({})
279
- ____exports.SerializationType.NONE = 0
280
- ____exports.SerializationType[____exports.SerializationType.NONE] = "NONE"
281
- ____exports.SerializationType.SERIALIZE = 1
282
- ____exports.SerializationType[____exports.SerializationType.SERIALIZE] = "SERIALIZE"
283
- ____exports.SerializationType.DESERIALIZE = 2
284
- ____exports.SerializationType[____exports.SerializationType.DESERIALIZE] = "DESERIALIZE"
285
280
  TSTL_CLASS_KEYS = __TS__New(Set, {"____constructor", "__index", "constructor"})
286
281
  return ____exports
@@ -10,11 +10,12 @@ local ____DefaultMap = require("classes.DefaultMap")
10
10
  local DefaultMap = ____DefaultMap.DefaultMap
11
11
  local ____SerializationBrand = require("enums.private.SerializationBrand")
12
12
  local SerializationBrand = ____SerializationBrand.SerializationBrand
13
+ local ____SerializationType = require("enums.SerializationType")
14
+ local SerializationType = ____SerializationType.SerializationType
13
15
  local ____array = require("functions.array")
14
16
  local arrayEquals = ____array.arrayEquals
15
17
  local ____deepCopy = require("functions.deepCopy")
16
18
  local deepCopy = ____deepCopy.deepCopy
17
- local SerializationType = ____deepCopy.SerializationType
18
19
  local ____log = require("functions.log")
19
20
  local log = ____log.log
20
21
  function copiedObjectIsTable(self)
@@ -294,10 +295,6 @@ function copiedDefaultMapHasBrand(self)
294
295
  if not (newTable[SerializationBrand.DEFAULT_MAP] ~= nil) then
295
296
  error("The copied DefaultMap does not have the brand: " .. SerializationBrand.DEFAULT_MAP)
296
297
  end
297
- local serializedDefaultValue = newTable[SerializationBrand.DEFAULT_MAP]
298
- if serializedDefaultValue ~= oldDefaultValue then
299
- error("The copied DefaultMap does not have a serialized default value of: " .. oldDefaultValue)
300
- end
301
298
  end
302
299
  function ____exports.deepCopyTests(self)
303
300
  copiedObjectIsTable(nil)
@@ -315,6 +312,6 @@ function ____exports.deepCopyTests(self)
315
312
  copiedMapHasChildMap(nil)
316
313
  copiedDefaultMapHasChildDefaultMap(nil)
317
314
  copiedDefaultMapHasBrand(nil)
318
- log("All tests passed!")
315
+ log("All deep copy tests passed!")
319
316
  end
320
317
  return ____exports
@@ -0,0 +1 @@
1
+ export declare function mergeTests(): void;
@@ -0,0 +1,120 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ local oldTableHasUpdatedValue, newTableHasSameValue, oldTableHasUpdatedValueFromNull, oldTableHasFilledInterface, oldTableHasVector, oldTableHasVectorSerialized
4
+ local ____SerializationType = require("enums.SerializationType")
5
+ local SerializationType = ____SerializationType.SerializationType
6
+ local ____merge = require("features.saveDataManager.merge")
7
+ local merge = ____merge.merge
8
+ local ____deepCopy = require("functions.deepCopy")
9
+ local deepCopy = ____deepCopy.deepCopy
10
+ local ____log = require("functions.log")
11
+ local log = ____log.log
12
+ local ____vector = require("functions.vector")
13
+ local isVector = ____vector.isVector
14
+ function oldTableHasUpdatedValue(self)
15
+ local key = "foo"
16
+ local oldValue = "bar"
17
+ local newValue = "baz"
18
+ local oldTable = {foo = oldValue}
19
+ local newTable = {foo = newValue}
20
+ merge(nil, oldTable, newTable, "oldTableHasUpdatedValue")
21
+ local oldTableValue = oldTable[key]
22
+ if oldTableValue ~= newValue then
23
+ error("The old table does not have a value of: " .. newValue)
24
+ end
25
+ end
26
+ function newTableHasSameValue(self)
27
+ local key = "foo"
28
+ local oldValue = "bar"
29
+ local newValue = "baz"
30
+ local oldTable = {foo = oldValue}
31
+ local newTable = {foo = newValue}
32
+ merge(nil, oldTable, newTable, "newTableHasSameValue")
33
+ local newTableValue = newTable[key]
34
+ if newTableValue ~= newValue then
35
+ error("The new table does not have a value of: " .. newValue)
36
+ end
37
+ end
38
+ function oldTableHasUpdatedValueFromNull(self)
39
+ local key = "foo"
40
+ local newValue = "baz"
41
+ local oldTable = {foo = nil}
42
+ local newTable = {foo = newValue}
43
+ merge(nil, oldTable, newTable, "oldTableHasUpdatedValueFromNull")
44
+ local oldTableValue = oldTable[key]
45
+ if oldTableValue ~= newValue then
46
+ error("The old table does not have a value of: " .. newValue)
47
+ end
48
+ end
49
+ function oldTableHasFilledInterface(self)
50
+ local key = "foo"
51
+ local newValue = "baz"
52
+ local oldTable = {foo = nil}
53
+ local foo = {bar = newValue}
54
+ local newTable = {foo = foo}
55
+ merge(nil, oldTable, newTable, "oldTableHasFilledInterface")
56
+ local oldTableValue = oldTable[key]
57
+ if oldTableValue == nil then
58
+ error(("The old table's key of \"" .. key) .. "\" was not filled.")
59
+ end
60
+ if oldTableValue.bar ~= newValue then
61
+ error("The old table's key of \"bar\" was not filled.")
62
+ end
63
+ end
64
+ function oldTableHasVector(self)
65
+ local key = "foo"
66
+ local x = 50
67
+ local y = 60
68
+ local newValue = Vector(x, y)
69
+ local oldTable = {foo = nil}
70
+ local foo = {bar = newValue}
71
+ local newTable = {foo = foo}
72
+ merge(nil, oldTable, newTable, "oldTableHasVector")
73
+ local oldTableValue = oldTable[key]
74
+ if oldTableValue == nil then
75
+ error(("The old table's key of \"" .. key) .. "\" was not filled.")
76
+ end
77
+ if oldTableValue.bar.X ~= x then
78
+ error("The old table's value for \"x\" does not match: " .. tostring(x))
79
+ end
80
+ if oldTableValue.bar.Y ~= y then
81
+ error("The old table's value for \"y\" does not match: " .. tostring(y))
82
+ end
83
+ if not isVector(nil, oldTableValue.bar) then
84
+ error("The old table's value is not a Vector object.")
85
+ end
86
+ end
87
+ function oldTableHasVectorSerialized(self)
88
+ local key = "foo"
89
+ local x = 50
90
+ local y = 60
91
+ local newValue = Vector(x, y)
92
+ local oldTable = {foo = nil}
93
+ local foo = {bar = newValue}
94
+ local newTable = {foo = foo}
95
+ local newTableSerialized = deepCopy(nil, newTable, SerializationType.SERIALIZE)
96
+ merge(nil, oldTable, newTableSerialized, "oldTableHasVectorSerialized")
97
+ local oldTableValue = oldTable[key]
98
+ if oldTableValue == nil then
99
+ error(("The old table's key of \"" .. key) .. "\" was not filled.")
100
+ end
101
+ if oldTableValue.bar.X ~= x then
102
+ error("The old table's value for \"x\" does not match: " .. tostring(x))
103
+ end
104
+ if oldTableValue.bar.Y ~= y then
105
+ error("The old table's value for \"y\" does not match: " .. tostring(y))
106
+ end
107
+ if not isVector(nil, oldTableValue.bar) then
108
+ error("The old table's value is not a Vector object.")
109
+ end
110
+ end
111
+ function ____exports.mergeTests(self)
112
+ oldTableHasUpdatedValue(nil)
113
+ newTableHasSameValue(nil)
114
+ oldTableHasUpdatedValueFromNull(nil)
115
+ oldTableHasFilledInterface(nil)
116
+ oldTableHasVector(nil)
117
+ oldTableHasVectorSerialized(nil)
118
+ log("All merge tests passed!")
119
+ end
120
+ return ____exports
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export * from "./enums/ModCallbacksCustom";
12
12
  export * from "./enums/PillEffectClass";
13
13
  export * from "./enums/PillEffectType";
14
14
  export * from "./enums/PocketItemType";
15
+ export * from "./enums/SerializationType";
15
16
  export { deployJSONRoom, deployRandomJSONRoom, emptyRoom, } from "./features/deployJSONRoom";
16
17
  export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
17
18
  export { disableAllSound, enableAllSound } from "./features/disableSound";
@@ -52,6 +53,7 @@ export * from "./functions/language";
52
53
  export * from "./functions/log";
53
54
  export * from "./functions/map";
54
55
  export * from "./functions/math";
56
+ export { mergeTests } from "./functions/mergeTests";
55
57
  export * from "./functions/npc";
56
58
  export * from "./functions/pickups";
57
59
  export * from "./functions/pills";
package/dist/index.lua CHANGED
@@ -110,6 +110,14 @@ do
110
110
  end
111
111
  end
112
112
  end
113
+ do
114
+ local ____export = require("enums.SerializationType")
115
+ for ____exportKey, ____exportValue in pairs(____export) do
116
+ if ____exportKey ~= "default" then
117
+ ____exports[____exportKey] = ____exportValue
118
+ end
119
+ end
120
+ end
113
121
  do
114
122
  local ____deployJSONRoom = require("features.deployJSONRoom")
115
123
  local deployJSONRoom = ____deployJSONRoom.deployJSONRoom
@@ -421,6 +429,11 @@ do
421
429
  end
422
430
  end
423
431
  end
432
+ do
433
+ local ____mergeTests = require("functions.mergeTests")
434
+ local mergeTests = ____mergeTests.mergeTests
435
+ ____exports.mergeTests = mergeTests
436
+ end
424
437
  do
425
438
  local ____export = require("functions.npc")
426
439
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,8 @@
1
+ export interface TSTLClassMetatable {
2
+ ____constructor: () => void;
3
+ __index: unknown;
4
+ constructor: {
5
+ prototype: unknown;
6
+ name: string;
7
+ };
8
+ }
@@ -0,0 +1,3 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ local ____exports = {}
3
+ return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.170",
3
+ "version": "1.2.173",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.370",
28
+ "isaac-typescript-definitions": "^1.0.371",
29
29
  "isaacscript-lint": "^1.0.91",
30
30
  "isaacscript-tsconfig": "^1.1.8",
31
31
  "typedoc": "^0.22.13",