isaacscript-common 1.2.171 → 1.2.172
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.
- package/dist/callbacks/postNewRoomEarly.lua +3 -3
- package/dist/enums/SerializationType.d.ts +5 -0
- package/dist/enums/SerializationType.lua +10 -0
- package/dist/features/saveDataManager/exports.lua +2 -1
- package/dist/features/saveDataManager/main.lua +2 -1
- package/dist/features/saveDataManager/merge.lua +18 -8
- package/dist/features/saveDataManager/save.lua +2 -1
- package/dist/functions/deepCopy.d.ts +1 -5
- package/dist/functions/deepCopy.lua +18 -23
- package/dist/functions/deepCopyTests.lua +3 -6
- package/dist/functions/mergeTests.d.ts +1 -0
- package/dist/functions/mergeTests.lua +65 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.lua +13 -0
- package/dist/types/private/TSTLClassMetatable.d.ts +8 -0
- package/dist/types/private/TSTLClassMetatable.lua +3 -0
- package/package.json +1 -1
|
@@ -36,14 +36,14 @@ function checkRoomChanged(self)
|
|
|
36
36
|
log("Error: Failed to spawn a new wall (1) for the PostNewRoomEarly callback.")
|
|
37
37
|
return
|
|
38
38
|
end
|
|
39
|
-
log("Spawned a new wall (
|
|
39
|
+
log("Spawned a new wall (1) for the PostNewRoomEarly callback.")
|
|
40
40
|
end
|
|
41
41
|
local rightOfTopWallGridIndex = topLeftWallGridIndex + 1
|
|
42
42
|
local topLeftWall2 = room:GetGridEntity(rightOfTopWallGridIndex)
|
|
43
43
|
if topLeftWall2 == nil then
|
|
44
|
-
topLeftWall2 = spawnGridEntity(nil, GridEntityType.GRID_WALL,
|
|
44
|
+
topLeftWall2 = spawnGridEntity(nil, GridEntityType.GRID_WALL, rightOfTopWallGridIndex)
|
|
45
45
|
if topLeftWall2 == nil then
|
|
46
|
-
log("Error: Failed to spawn a new wall (
|
|
46
|
+
log("Error: Failed to spawn a new wall (2) for the PostNewRoomEarly callback.")
|
|
47
47
|
return
|
|
48
48
|
end
|
|
49
49
|
log("Spawned a new wall (2) for the PostNewRoomEarly callback.")
|
|
@@ -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,19 +88,28 @@ 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
|
|
100
|
+
goto __continue23
|
|
94
101
|
end
|
|
95
102
|
if mergeVector(nil, oldTable, key, value) then
|
|
96
|
-
goto
|
|
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 == "
|
|
109
|
+
if oldValueType == "nil" then
|
|
110
|
+
local valueDeepCopy = deepCopy(nil, value)
|
|
111
|
+
oldTable[key] = valueDeepCopy
|
|
112
|
+
elseif oldValueType == "table" then
|
|
103
113
|
traversalDescription = addTraversalDescription(nil, key, traversalDescription)
|
|
104
114
|
____exports.merge(nil, oldValue, value, traversalDescription)
|
|
105
115
|
end
|
|
@@ -110,7 +120,7 @@ function mergeTable(self, oldTable, newTable, traversalDescription)
|
|
|
110
120
|
oldTable[key] = value
|
|
111
121
|
end
|
|
112
122
|
end
|
|
113
|
-
::
|
|
123
|
+
::__continue23::
|
|
114
124
|
end
|
|
115
125
|
end
|
|
116
126
|
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
|
-
|
|
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 =
|
|
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 ==
|
|
32
|
+
if serializationType == SerializationType.SERIALIZE then
|
|
35
33
|
logString = logString .. " (serializing)"
|
|
36
|
-
elseif serializationType ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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 ==
|
|
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,65 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
local ____exports = {}
|
|
3
|
+
local oldTableHasUpdatedValue, newTableHasSameValue, oldTableHasUpdatedValueFromNull, oldTableHasFilledInterface
|
|
4
|
+
local ____merge = require("features.saveDataManager.merge")
|
|
5
|
+
local merge = ____merge.merge
|
|
6
|
+
local ____log = require("functions.log")
|
|
7
|
+
local log = ____log.log
|
|
8
|
+
function oldTableHasUpdatedValue(self)
|
|
9
|
+
local key = "foo"
|
|
10
|
+
local oldValue = "bar"
|
|
11
|
+
local newValue = "baz"
|
|
12
|
+
local oldTable = {foo = oldValue}
|
|
13
|
+
local newTable = {foo = newValue}
|
|
14
|
+
merge(nil, oldTable, newTable, "oldTableHasUpdatedValue")
|
|
15
|
+
local oldTableValue = oldTable[key]
|
|
16
|
+
if oldTableValue ~= newValue then
|
|
17
|
+
error("The old table does not have a value of: " .. newValue)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
function newTableHasSameValue(self)
|
|
21
|
+
local key = "foo"
|
|
22
|
+
local oldValue = "bar"
|
|
23
|
+
local newValue = "baz"
|
|
24
|
+
local oldTable = {foo = oldValue}
|
|
25
|
+
local newTable = {foo = newValue}
|
|
26
|
+
merge(nil, oldTable, newTable, "newTableHasSameValue")
|
|
27
|
+
local newTableValue = newTable[key]
|
|
28
|
+
if newTableValue ~= newValue then
|
|
29
|
+
error("The new table does not have a value of: " .. newValue)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
function oldTableHasUpdatedValueFromNull(self)
|
|
33
|
+
local key = "foo"
|
|
34
|
+
local newValue = "baz"
|
|
35
|
+
local oldTable = {foo = nil}
|
|
36
|
+
local newTable = {foo = newValue}
|
|
37
|
+
merge(nil, oldTable, newTable, "oldTableHasUpdatedValueFromNull")
|
|
38
|
+
local oldTableValue = oldTable[key]
|
|
39
|
+
if oldTableValue ~= newValue then
|
|
40
|
+
error("The old table does not have a value of: " .. newValue)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
function oldTableHasFilledInterface(self)
|
|
44
|
+
local key = "foo"
|
|
45
|
+
local newValue = "baz"
|
|
46
|
+
local oldTable = {foo = nil}
|
|
47
|
+
local foo = {bar = newValue}
|
|
48
|
+
local newTable = {foo = foo}
|
|
49
|
+
merge(nil, oldTable, newTable, "oldTableHasFilledInterface")
|
|
50
|
+
local oldTableValue = oldTable[key]
|
|
51
|
+
if oldTableValue == nil then
|
|
52
|
+
error(("The old table's key of \"" .. key) .. "\" was not filled.")
|
|
53
|
+
end
|
|
54
|
+
if oldTableValue.bar ~= newValue then
|
|
55
|
+
error("The old table's key of \"bar\" was not filled.")
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
function ____exports.mergeTests(self)
|
|
59
|
+
oldTableHasUpdatedValue(nil)
|
|
60
|
+
newTableHasSameValue(nil)
|
|
61
|
+
oldTableHasUpdatedValueFromNull(nil)
|
|
62
|
+
oldTableHasFilledInterface(nil)
|
|
63
|
+
log("All merge tests passed!")
|
|
64
|
+
end
|
|
65
|
+
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
|