isaacscript-common 9.13.0 → 9.13.3

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 (43) hide show
  1. package/dist/callbacks/customRevive.lua +5 -2
  2. package/dist/callbacks/postNewRoomEarly.lua +2 -2
  3. package/dist/features/customPickup.d.ts +1 -1
  4. package/dist/features/customPickup.d.ts.map +1 -1
  5. package/dist/features/customPickup.lua +2 -2
  6. package/dist/features/customStage/customStageUtils.lua +16 -4
  7. package/dist/features/customStage/exports.d.ts.map +1 -1
  8. package/dist/features/customStage/exports.lua +17 -5
  9. package/dist/features/deployJSONRoom.lua +15 -9
  10. package/dist/features/extraConsoleCommands/commandsSubroutines.lua +2 -2
  11. package/dist/features/extraConsoleCommands/listCommands.lua +4 -4
  12. package/dist/features/pause.lua +2 -2
  13. package/dist/features/saveDataManager/load.lua +7 -4
  14. package/dist/features/saveDataManager/main.lua +2 -2
  15. package/dist/features/saveDataManager/merge.lua +3 -3
  16. package/dist/features/saveDataManager/save.lua +1 -1
  17. package/dist/features/taintedLazarusPlayers.lua +1 -1
  18. package/dist/functions/benchmark.lua +8 -2
  19. package/dist/functions/debug.lua +1 -1
  20. package/dist/functions/deepCopy.lua +8 -8
  21. package/dist/functions/deepCopyTests.lua +1 -1
  22. package/dist/functions/globals.lua +6 -3
  23. package/dist/functions/hex.lua +7 -4
  24. package/dist/functions/jsonHelpers.lua +1 -1
  25. package/dist/functions/jsonRoom.lua +8 -2
  26. package/dist/functions/log.d.ts +26 -26
  27. package/dist/functions/log.d.ts.map +1 -1
  28. package/dist/functions/log.lua +209 -98
  29. package/dist/functions/logEntities.d.ts +8 -8
  30. package/dist/functions/logEntities.d.ts.map +1 -1
  31. package/dist/functions/logEntities.lua +21 -18
  32. package/dist/functions/mergeTests.lua +1 -1
  33. package/dist/functions/run.lua +5 -2
  34. package/dist/functions/set.d.ts.map +1 -1
  35. package/dist/functions/set.lua +9 -0
  36. package/dist/index.d.ts +35 -35
  37. package/package.json +2 -2
  38. package/src/features/customPickup.ts +5 -4
  39. package/src/features/customStage/exports.ts +0 -1
  40. package/src/functions/log.ts +23 -48
  41. package/src/functions/logEntities.ts +6 -8
  42. package/src/functions/set.ts +13 -0
  43. package/src/lib/jsonLua.d.ts +4 -2
@@ -10,50 +10,50 @@ export declare function getDebugPrependString(msg: string, numParentFunctions?:
10
10
  * If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
11
11
  * function will also prepend the function name and the line number before the string.
12
12
  */
13
- export declare function log(this: void, msg: string): void;
14
- export declare function logArray<T>(this: void, array: T[] | readonly T[]): void;
15
- export declare function logCollectibleTypes(this: void, collectibleTypes: CollectibleType[]): void;
16
- export declare function logColor(this: void, color: Color): void;
13
+ export declare function log(msg: string): void;
14
+ export declare function logArray<T>(array: T[] | readonly T[]): void;
15
+ export declare function logCollectibleTypes(collectibleTypes: CollectibleType[]): void;
16
+ export declare function logColor(color: Color): void;
17
17
  /** Helper function for printing out every damage flag that is turned on. Useful when debugging. */
18
- export declare function logDamageFlags(this: void, flags: DamageFlag | BitFlags<DamageFlag>): void;
18
+ export declare function logDamageFlags(flags: DamageFlag | BitFlags<DamageFlag>): void;
19
19
  /** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
20
- export declare function logEntityFlags(this: void, flags: EntityFlag | BitFlags<EntityFlag>): void;
21
- export declare function logEntityID(this: void, entity: Entity): void;
20
+ export declare function logEntityFlags(flags: EntityFlag | BitFlags<EntityFlag>): void;
21
+ export declare function logEntityID(entity: Entity): void;
22
22
  /**
23
23
  * Helper function to log an error message and also print it to the console for better visibility.
24
24
  *
25
25
  * This is useful in situations where using the `error` function would be dangerous (since it
26
26
  * prevents all of the subsequent code in the callback from running).
27
27
  */
28
- export declare function logError(this: void, msg: string): void;
28
+ export declare function logError(msg: string): void;
29
29
  /** Helper function for printing out every flag that is turned on. Useful when debugging. */
30
- export declare function logFlags<T extends BitFlag | BitFlag128>(this: void, flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
30
+ export declare function logFlags<T extends BitFlag | BitFlag128>(flags: T | BitFlags<T>, flagEnum: Record<string, T>, description?: string): void;
31
31
  /**
32
32
  * Helper function for printing out every game state flag that is turned on. Useful when debugging.
33
33
  */
34
- export declare function logGameStateFlags(this: void): void;
35
- export declare function logKColor(this: void, kColor: KColor): void;
34
+ export declare function logGameStateFlags(): void;
35
+ export declare function logKColor(kColor: KColor): void;
36
36
  /**
37
37
  * Helper function for printing out every level state flag that is turned on. Useful when debugging.
38
38
  */
39
- export declare function logLevelStateFlags(this: void): void;
40
- export declare function logMap(this: void, map: Map<AnyNotNil, unknown>): void;
41
- export declare function logPlayerEffects(this: void, player: EntityPlayer): void;
42
- export declare function logPlayerHealth(this: void, player: EntityPlayer): void;
39
+ export declare function logLevelStateFlags(): void;
40
+ export declare function logMap(map: Map<AnyNotNil, unknown>): void;
41
+ export declare function logPlayerEffects(player: EntityPlayer): void;
42
+ export declare function logPlayerHealth(player: EntityPlayer): void;
43
43
  /**
44
44
  * Helper function for printing out every projectile flag that is turned on. Useful when debugging.
45
45
  */
46
- export declare function logProjectileFlags(this: void, flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
46
+ export declare function logProjectileFlags(flags: ProjectileFlag | BitFlags<ProjectileFlag>): void;
47
47
  /** Helper function for logging information about the current room. */
48
- export declare function logRoom(this: void): void;
48
+ export declare function logRoom(): void;
49
49
  /**
50
50
  * Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
51
51
  * particular run.
52
52
  */
53
- export declare function logSeedEffects(this: void): void;
54
- export declare function logSet(this: void, set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
53
+ export declare function logSeedEffects(): void;
54
+ export declare function logSet(set: Set<AnyNotNil> | ReadonlySet<AnyNotNil>): void;
55
55
  /** Helper function for logging every sound effect that is currently playing. */
56
- export declare function logSounds(this: void): void;
56
+ export declare function logSounds(): void;
57
57
  /**
58
58
  * Helper function for logging every key and value of a table. This is a deep log; the function will
59
59
  * recursively call itself if it counters a table within a table.
@@ -61,20 +61,20 @@ export declare function logSounds(this: void): void;
61
61
  * This function will only work on tables that have string keys (because it logs the keys in order,
62
62
  * instead of randomly). It will throw a run-time error if it encounters a non-string key.
63
63
  */
64
- export declare function logTable(this: void, luaTable: unknown, parentTables?: number): void;
64
+ export declare function logTable(luaTable: unknown, parentTables?: number): void;
65
65
  /**
66
66
  * Helper function to print out the differences between the entries of two tables. Note that this
67
67
  * will only do a shallow comparison.
68
68
  */
69
- export declare function logTableDifferences<K, V>(this: void, table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
69
+ export declare function logTableDifferences<K, V>(table1: LuaMap<K, V>, table2: LuaMap<K, V>): void;
70
70
  /** Helper function for printing out every tear flag that is turned on. Useful when debugging. */
71
- export declare function logTearFlags(this: void, flags: TearFlag | BitFlags<TearFlag>): void;
71
+ export declare function logTearFlags(flags: TearFlag | BitFlags<TearFlag>): void;
72
72
  /** Helper function for printing out every use flag that is turned on. Useful when debugging. */
73
- export declare function logUseFlags(this: void, flags: UseFlag | BitFlags<UseFlag>): void;
73
+ export declare function logUseFlags(flags: UseFlag | BitFlags<UseFlag>): void;
74
74
  /**
75
75
  * Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
76
76
  * the Isaac API).
77
77
  */
78
- export declare function logUserdata(this: void, userdata: unknown): void;
79
- export declare function logVector(this: void, vector: Vector, round?: boolean): void;
78
+ export declare function logUserdata(userdata: unknown): void;
79
+ export declare function logVector(vector: Vector, round?: boolean): void;
80
80
  //# sourceMappingURL=log.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/functions/log.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,eAAe,EACf,UAAU,EACV,UAAU,EAKV,cAAc,EAGd,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAkBtC;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAA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I,CAQhC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,SAAI,GAAG,IAAI,CA2ClE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GACnB,IAAI,CA0BN;AAED,iGAAiG;AACjG,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,IAAI,CAEvE;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAEpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAsBnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,IAAI,CAG7D"}
@@ -78,72 +78,84 @@ end
78
78
  --
79
79
  -- If you have the "--luadebug" launch flag turned on or the Racing+ sandbox enabled, then this
80
80
  -- function will also prepend the function name and the line number before the string.
81
- function ____exports.log(msg)
81
+ function ____exports.log(self, msg)
82
82
  local debugMsg = ____exports.getDebugPrependString(nil, msg)
83
83
  Isaac.DebugString(debugMsg)
84
84
  end
85
85
  --- Helper function for printing out every flag that is turned on. Useful when debugging.
86
- function ____exports.logFlags(flags, flagEnum, description)
86
+ function ____exports.logFlags(self, flags, flagEnum, description)
87
87
  if description == nil then
88
88
  description = ""
89
89
  end
90
90
  if description ~= "" then
91
91
  description = "flag"
92
92
  end
93
- ____exports.log((("Logging " .. description) .. " values for: ") .. tostring(flags))
93
+ ____exports.log(
94
+ nil,
95
+ (("Logging " .. description) .. " values for: ") .. tostring(flags)
96
+ )
94
97
  local hasNoFlags = true
95
98
  for ____, ____value in ipairs(getEnumEntries(nil, flagEnum)) do
96
99
  local key = ____value[1]
97
100
  local value = ____value[2]
98
101
  if hasFlag(nil, flags, value) then
99
- ____exports.log((((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")")
102
+ ____exports.log(
103
+ nil,
104
+ (((" Has flag: " .. key) .. " (") .. tostring(value)) .. ")"
105
+ )
100
106
  hasNoFlags = false
101
107
  end
102
108
  end
103
109
  if hasNoFlags then
104
- ____exports.log(" n/a (no flags)")
110
+ ____exports.log(nil, " n/a (no flags)")
105
111
  end
106
112
  end
107
- function ____exports.logArray(array)
113
+ function ____exports.logArray(self, array)
108
114
  local arrayString = arrayToString(nil, array)
109
- ____exports.log("Array: " .. arrayString)
115
+ ____exports.log(nil, "Array: " .. arrayString)
110
116
  end
111
- function ____exports.logCollectibleTypes(collectibleTypes)
112
- ____exports.log("Collectibles:")
117
+ function ____exports.logCollectibleTypes(self, collectibleTypes)
118
+ ____exports.log(nil, "Collectibles:")
113
119
  local i = 1
114
120
  for ____, collectibleType in ipairs(collectibleTypes) do
115
121
  local collectibleName = getCollectibleName(nil, collectibleType)
116
- ____exports.log(((((tostring(i) .. ") ") .. collectibleName) .. " (") .. tostring(collectibleType)) .. ")")
122
+ ____exports.log(
123
+ nil,
124
+ ((((tostring(i) .. ") ") .. collectibleName) .. " (") .. tostring(collectibleType)) .. ")"
125
+ )
117
126
  i = i + 1
118
127
  end
119
128
  end
120
- function ____exports.logColor(color)
121
- ____exports.log((((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO))
129
+ function ____exports.logColor(self, color)
130
+ ____exports.log(
131
+ nil,
132
+ (((((((((((("Color: R" .. tostring(color.R)) .. ", G") .. tostring(color.G)) .. ", B") .. tostring(color.B)) .. ", A") .. tostring(color.A)) .. ", RO") .. tostring(color.RO)) .. ", BO") .. tostring(color.BO)) .. ", GO") .. tostring(color.GO)
133
+ )
122
134
  end
123
135
  --- Helper function for printing out every damage flag that is turned on. Useful when debugging.
124
- function ____exports.logDamageFlags(flags)
125
- ____exports.logFlags(flags, DamageFlag, "damage")
136
+ function ____exports.logDamageFlags(self, flags)
137
+ ____exports.logFlags(nil, flags, DamageFlag, "damage")
126
138
  end
127
139
  --- Helper function for printing out every entity flag that is turned on. Useful when debugging.
128
- function ____exports.logEntityFlags(flags)
129
- ____exports.logFlags(flags, EntityFlag, "entity")
140
+ function ____exports.logEntityFlags(self, flags)
141
+ ____exports.logFlags(nil, flags, EntityFlag, "entity")
130
142
  end
131
- function ____exports.logEntityID(entity)
143
+ function ____exports.logEntityID(self, entity)
132
144
  local entityID = getEntityID(nil, entity)
133
- ____exports.log("Entity: " .. entityID)
145
+ ____exports.log(nil, "Entity: " .. entityID)
134
146
  end
135
147
  --- Helper function to log an error message and also print it to the console for better visibility.
136
148
  --
137
149
  -- This is useful in situations where using the `error` function would be dangerous (since it
138
150
  -- prevents all of the subsequent code in the callback from running).
139
- function ____exports.logError(msg)
151
+ function ____exports.logError(self, msg)
140
152
  local errorMsg = "Error: " .. msg
141
- ____exports.log(errorMsg)
153
+ ____exports.log(nil, errorMsg)
142
154
  printConsole(nil, errorMsg)
143
155
  end
144
156
  --- Helper function for printing out every game state flag that is turned on. Useful when debugging.
145
- function ____exports.logGameStateFlags()
146
- ____exports.log("Logging game state flags:")
157
+ function ____exports.logGameStateFlags(self)
158
+ ____exports.log(nil, "Logging game state flags:")
147
159
  local gameStateFlagEntries = getEnumEntries(nil, GameStateFlag)
148
160
  local hasNoFlags = true
149
161
  for ____, ____value in ipairs(gameStateFlagEntries) do
@@ -151,51 +163,66 @@ function ____exports.logGameStateFlags()
151
163
  local gameStateFlag = ____value[2]
152
164
  local flagValue = game:GetStateFlag(gameStateFlag)
153
165
  if flagValue then
154
- ____exports.log((((" Has flag: " .. key) .. " (") .. tostring(gameStateFlag)) .. ")")
166
+ ____exports.log(
167
+ nil,
168
+ (((" Has flag: " .. key) .. " (") .. tostring(gameStateFlag)) .. ")"
169
+ )
155
170
  hasNoFlags = false
156
171
  end
157
172
  end
158
173
  if hasNoFlags then
159
- ____exports.log(" n/a (no flags)")
174
+ ____exports.log(nil, " n/a (no flags)")
160
175
  end
161
176
  end
162
- function ____exports.logKColor(kColor)
163
- ____exports.log((((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha))
177
+ function ____exports.logKColor(self, kColor)
178
+ ____exports.log(
179
+ nil,
180
+ (((((("Color: R" .. tostring(kColor.Red)) .. ", G") .. tostring(kColor.Green)) .. ", B") .. tostring(kColor.Blue)) .. ", A") .. tostring(kColor.Alpha)
181
+ )
164
182
  end
165
183
  --- Helper function for printing out every level state flag that is turned on. Useful when debugging.
166
- function ____exports.logLevelStateFlags()
184
+ function ____exports.logLevelStateFlags(self)
167
185
  local level = game:GetLevel()
168
186
  local levelStateFlagEntries = getEnumEntries(nil, LevelStateFlag)
169
- ____exports.log("Logging level state flags:")
187
+ ____exports.log(nil, "Logging level state flags:")
170
188
  local hasNoFlags = true
171
189
  for ____, ____value in ipairs(levelStateFlagEntries) do
172
190
  local key = ____value[1]
173
191
  local levelStateFlag = ____value[2]
174
192
  local flagValue = level:GetStateFlag(levelStateFlag)
175
193
  if flagValue then
176
- ____exports.log((((" Has flag: " .. key) .. " (") .. tostring(levelStateFlag)) .. ")")
194
+ ____exports.log(
195
+ nil,
196
+ (((" Has flag: " .. key) .. " (") .. tostring(levelStateFlag)) .. ")"
197
+ )
177
198
  hasNoFlags = false
178
199
  end
179
200
  end
180
201
  if hasNoFlags then
181
- ____exports.log(" n/a (no flags)")
202
+ ____exports.log(nil, " n/a (no flags)")
182
203
  end
183
204
  end
184
- function ____exports.logMap(map)
185
- ____exports.log("Printing out a TSTL Map:")
205
+ function ____exports.logMap(self, map)
206
+ ____exports.log(nil, "Printing out a TSTL Map:")
186
207
  local mapKeys = {__TS__Spread(map:keys())}
187
208
  __TS__ArraySort(mapKeys)
188
209
  for ____, key in ipairs(mapKeys) do
189
210
  local value = map:get(key)
190
- ____exports.log(((" " .. tostring(key)) .. " --> ") .. tostring(value))
211
+ ____exports.log(
212
+ nil,
213
+ ((" " .. tostring(key)) .. " --> ") .. tostring(value)
214
+ )
191
215
  end
192
- ____exports.log(" The size of the map was: " .. tostring(map.size))
216
+ ____exports.log(
217
+ nil,
218
+ " The size of the map was: " .. tostring(map.size)
219
+ )
193
220
  end
194
- function ____exports.logPlayerEffects(player)
221
+ function ____exports.logPlayerEffects(self, player)
195
222
  local effects = getEffectsList(nil, player)
196
- ____exports.log("Logging player effects:")
223
+ ____exports.log(nil, "Logging player effects:")
197
224
  if #effects == 0 then
198
- ____exports.log(" n/a (no effects)")
225
+ ____exports.log(nil, " n/a (no effects)")
199
226
  return
200
227
  end
201
228
  __TS__ArrayForEach(
@@ -213,92 +240,158 @@ function ____exports.logPlayerEffects(player)
213
240
  else
214
241
  effectDescription = "Unknown type of effect: " .. tostring(effect.Item.ID)
215
242
  end
216
- ____exports.log((((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")")
243
+ ____exports.log(
244
+ nil,
245
+ (((((" " .. tostring(i + 1)) .. ") ") .. effectDescription) .. " (x") .. tostring(effect.Count)) .. ")"
246
+ )
217
247
  end
218
248
  )
219
249
  end
220
- function ____exports.logPlayerHealth(player)
250
+ function ____exports.logPlayerHealth(self, player)
221
251
  local playerName = getPlayerName(nil, player)
222
252
  local playerHealth = getPlayerHealth(nil, player)
223
- ____exports.log(("Player health for " .. playerName) .. ":")
224
- ____exports.log(" Max hearts: " .. tostring(playerHealth.maxHearts))
225
- ____exports.log(" Hearts: " .. tostring(playerHealth.hearts))
226
- ____exports.log(" Eternal hearts: " .. tostring(playerHealth.eternalHearts))
227
- ____exports.log(" Soul hearts: " .. tostring(playerHealth.soulHearts))
228
- ____exports.log(" Bone hearts: " .. tostring(playerHealth.boneHearts))
229
- ____exports.log(" Golden hearts: " .. tostring(playerHealth.goldenHearts))
230
- ____exports.log(" Rotten hearts: " .. tostring(playerHealth.rottenHearts))
231
- ____exports.log(" Broken hearts: " .. tostring(playerHealth.brokenHearts))
232
- ____exports.log(" Soul charges: " .. tostring(playerHealth.soulCharges))
233
- ____exports.log(" Blood charges: " .. tostring(playerHealth.bloodCharges))
234
- ____exports.log(" Soul heart types: [")
253
+ ____exports.log(nil, ("Player health for " .. playerName) .. ":")
254
+ ____exports.log(
255
+ nil,
256
+ " Max hearts: " .. tostring(playerHealth.maxHearts)
257
+ )
258
+ ____exports.log(
259
+ nil,
260
+ " Hearts: " .. tostring(playerHealth.hearts)
261
+ )
262
+ ____exports.log(
263
+ nil,
264
+ " Eternal hearts: " .. tostring(playerHealth.eternalHearts)
265
+ )
266
+ ____exports.log(
267
+ nil,
268
+ " Soul hearts: " .. tostring(playerHealth.soulHearts)
269
+ )
270
+ ____exports.log(
271
+ nil,
272
+ " Bone hearts: " .. tostring(playerHealth.boneHearts)
273
+ )
274
+ ____exports.log(
275
+ nil,
276
+ " Golden hearts: " .. tostring(playerHealth.goldenHearts)
277
+ )
278
+ ____exports.log(
279
+ nil,
280
+ " Rotten hearts: " .. tostring(playerHealth.rottenHearts)
281
+ )
282
+ ____exports.log(
283
+ nil,
284
+ " Broken hearts: " .. tostring(playerHealth.brokenHearts)
285
+ )
286
+ ____exports.log(
287
+ nil,
288
+ " Soul charges: " .. tostring(playerHealth.soulCharges)
289
+ )
290
+ ____exports.log(
291
+ nil,
292
+ " Blood charges: " .. tostring(playerHealth.bloodCharges)
293
+ )
294
+ ____exports.log(nil, " Soul heart types: [")
235
295
  for ____, soulHeartType in ipairs(playerHealth.soulHeartTypes) do
236
- ____exports.log(" HeartSubType." .. tostring(HeartSubType[soulHeartType]))
296
+ ____exports.log(
297
+ nil,
298
+ " HeartSubType." .. tostring(HeartSubType[soulHeartType])
299
+ )
237
300
  end
238
- ____exports.log(" ]")
301
+ ____exports.log(nil, " ]")
239
302
  end
240
303
  --- Helper function for printing out every projectile flag that is turned on. Useful when debugging.
241
- function ____exports.logProjectileFlags(flags)
242
- ____exports.logFlags(flags, ProjectileFlag, "projectile")
304
+ function ____exports.logProjectileFlags(self, flags)
305
+ ____exports.logFlags(nil, flags, ProjectileFlag, "projectile")
243
306
  end
244
307
  --- Helper function for logging information about the current room.
245
- function ____exports.logRoom()
308
+ function ____exports.logRoom(self)
246
309
  local room = game:GetRoom()
247
310
  local bossID = room:GetBossID()
248
311
  local roomGridIndex = getRoomGridIndex(nil)
249
312
  local roomListIndex = getRoomListIndex(nil)
250
313
  local roomData = getRoomData(nil)
251
314
  if roomData == nil then
252
- ____exports.log("Current room data is undefined.")
315
+ ____exports.log(nil, "Current room data is undefined.")
253
316
  else
254
- ____exports.log("Current room stage ID: " .. tostring(roomData.StageID))
255
- ____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
256
- ____exports.log("Current room name: " .. roomData.Name)
317
+ ____exports.log(
318
+ nil,
319
+ "Current room stage ID: " .. tostring(roomData.StageID)
320
+ )
321
+ ____exports.log(
322
+ nil,
323
+ (((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype)
324
+ )
325
+ ____exports.log(nil, "Current room name: " .. roomData.Name)
257
326
  end
258
327
  local roomGridIndexName = GridRoom[roomGridIndex]
259
328
  if roomGridIndexName == nil then
260
- ____exports.log("Current room grid index: " .. tostring(roomGridIndex))
329
+ ____exports.log(
330
+ nil,
331
+ "Current room grid index: " .. tostring(roomGridIndex)
332
+ )
261
333
  else
262
- ____exports.log(((("Current room grid index: " .. tostring(roomGridIndex)) .. " (GridRoom.") .. roomGridIndexName) .. ")")
334
+ ____exports.log(
335
+ nil,
336
+ ((("Current room grid index: " .. tostring(roomGridIndex)) .. " (GridRoom.") .. roomGridIndexName) .. ")"
337
+ )
263
338
  end
264
- ____exports.log("Current room list index: " .. tostring(roomListIndex))
265
- ____exports.log("Current room boss ID: " .. tostring(bossID))
339
+ ____exports.log(
340
+ nil,
341
+ "Current room list index: " .. tostring(roomListIndex)
342
+ )
343
+ ____exports.log(
344
+ nil,
345
+ "Current room boss ID: " .. tostring(bossID)
346
+ )
266
347
  end
267
348
  --- Helper function for printing out every seed effect (i.e. Easter Egg) that is turned on for the
268
349
  -- particular run.
269
- function ____exports.logSeedEffects()
350
+ function ____exports.logSeedEffects(self)
270
351
  local seeds = game:GetSeeds()
271
352
  local seedEffectEntries = getEnumEntries(nil, SeedEffect)
272
- ____exports.log("Logging seed effects:")
353
+ ____exports.log(nil, "Logging seed effects:")
273
354
  local hasNoSeedEffects = true
274
355
  for ____, ____value in ipairs(seedEffectEntries) do
275
356
  local key = ____value[1]
276
357
  local seedEffect = ____value[2]
277
358
  if seeds:HasSeedEffect(seedEffect) then
278
- ____exports.log((((" " .. key) .. " (") .. tostring(seedEffect)) .. ")")
359
+ ____exports.log(
360
+ nil,
361
+ (((" " .. key) .. " (") .. tostring(seedEffect)) .. ")"
362
+ )
279
363
  hasNoSeedEffects = false
280
364
  end
281
365
  end
282
366
  if hasNoSeedEffects then
283
- ____exports.log(" n/a (no seed effects)")
367
+ ____exports.log(nil, " n/a (no seed effects)")
284
368
  end
285
369
  end
286
- function ____exports.logSet(set)
287
- ____exports.log("Printing out a TSTL Set:")
370
+ function ____exports.logSet(self, set)
371
+ ____exports.log(nil, "Printing out a TSTL Set:")
288
372
  local setValues = getSortedSetValues(nil, set)
289
373
  for ____, value in ipairs(setValues) do
290
- ____exports.log(" Value: " .. tostring(value))
374
+ ____exports.log(
375
+ nil,
376
+ " Value: " .. tostring(value)
377
+ )
291
378
  end
292
- ____exports.log(" The size of the set was: " .. tostring(set.size))
379
+ ____exports.log(
380
+ nil,
381
+ " The size of the set was: " .. tostring(set.size)
382
+ )
293
383
  end
294
384
  --- Helper function for logging every sound effect that is currently playing.
295
- function ____exports.logSounds()
385
+ function ____exports.logSounds(self)
296
386
  local soundEffects = getEnumEntries(nil, SoundEffect)
297
387
  for ____, ____value in ipairs(soundEffects) do
298
388
  local key = ____value[1]
299
389
  local soundEffect = ____value[2]
300
390
  if sfxManager:IsPlaying(soundEffect) then
301
- ____exports.log(((("Currently playing sound effect: " .. key) .. " (") .. tostring(soundEffect)) .. ")")
391
+ ____exports.log(
392
+ nil,
393
+ ((("Currently playing sound effect: " .. key) .. " (") .. tostring(soundEffect)) .. ")"
394
+ )
302
395
  end
303
396
  end
304
397
  end
@@ -307,12 +400,12 @@ end
307
400
  --
308
401
  -- This function will only work on tables that have string keys (because it logs the keys in order,
309
402
  -- instead of randomly). It will throw a run-time error if it encounters a non-string key.
310
- function ____exports.logTable(luaTable, parentTables)
403
+ function ____exports.logTable(self, luaTable, parentTables)
311
404
  if parentTables == nil then
312
405
  parentTables = 0
313
406
  end
314
407
  if parentTables == 0 then
315
- ____exports.log("Printing out a Lua table:")
408
+ ____exports.log(nil, "Printing out a Lua table:")
316
409
  end
317
410
  local numSpaces = (parentTables + 1) * 2
318
411
  local indentation = string.rep(
@@ -321,7 +414,10 @@ function ____exports.logTable(luaTable, parentTables)
321
414
  )
322
415
  if not isTable(nil, luaTable) then
323
416
  (function()
324
- ____exports.log(((indentation .. "n/a (encountered a variable of type \"") .. __TS__TypeOf(luaTable)) .. "\" instead of a table)")
417
+ ____exports.log(
418
+ nil,
419
+ ((indentation .. "n/a (encountered a variable of type \"") .. __TS__TypeOf(luaTable)) .. "\" instead of a table)"
420
+ )
325
421
  end)(nil)
326
422
  return
327
423
  end
@@ -330,25 +426,31 @@ function ____exports.logTable(luaTable, parentTables)
330
426
  nil,
331
427
  luaTable,
332
428
  function(____, key, value)
333
- ____exports.log(((indentation .. tostring(key)) .. " --> ") .. tostring(value))
429
+ ____exports.log(
430
+ nil,
431
+ ((indentation .. tostring(key)) .. " --> ") .. tostring(value)
432
+ )
334
433
  if isTable(nil, value) then
335
434
  if key == "__class" then
336
- ____exports.log(indentation .. " (skipping enumerating this key to avoid infinite recursion)")
435
+ ____exports.log(nil, indentation .. " (skipping enumerating this key to avoid infinite recursion)")
337
436
  else
338
- ____exports.logTable(value, parentTables + 1)
437
+ ____exports.logTable(nil, value, parentTables + 1)
339
438
  end
340
439
  end
341
440
  numElements = numElements + 1
342
441
  end
343
442
  );
344
443
  (function()
345
- ____exports.log((indentation .. "The size of the table was: ") .. tostring(numElements))
444
+ ____exports.log(
445
+ nil,
446
+ (indentation .. "The size of the table was: ") .. tostring(numElements)
447
+ )
346
448
  end)(nil)
347
449
  end
348
450
  --- Helper function to print out the differences between the entries of two tables. Note that this
349
451
  -- will only do a shallow comparison.
350
- function ____exports.logTableDifferences(table1, table2)
351
- ____exports.log("Comparing two Lua tables:")
452
+ function ____exports.logTableDifferences(self, table1, table2)
453
+ ____exports.log(nil, "Comparing two Lua tables:")
352
454
  local table1Keys = __TS__ObjectKeys(table1)
353
455
  local table1KeysSet = __TS__New(Set, table1Keys)
354
456
  local table2Keys = __TS__ObjectKeys(table2)
@@ -358,51 +460,60 @@ function ____exports.logTableDifferences(table1, table2)
358
460
  __TS__ArraySort(keys)
359
461
  for ____, key in ipairs(keys) do
360
462
  if not table1KeysSet:has(key) then
361
- ____exports.log(" Table 1 is missing key: " .. tostring(key))
463
+ ____exports.log(
464
+ nil,
465
+ " Table 1 is missing key: " .. tostring(key)
466
+ )
362
467
  elseif not table2KeysSet:has(key) then
363
- ____exports.log(" Table 2 is missing key: " .. tostring(key))
468
+ ____exports.log(
469
+ nil,
470
+ " Table 2 is missing key: " .. tostring(key)
471
+ )
364
472
  else
365
473
  local value1 = table1[key]
366
474
  local value2 = table2[key]
367
475
  if value1 ~= value2 then
368
- ____exports.log((((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\"")
476
+ ____exports.log(
477
+ nil,
478
+ (((((" " .. tostring(key)) .. " --> \"") .. tostring(value1)) .. "\" versus \"") .. tostring(value2)) .. "\""
479
+ )
369
480
  end
370
481
  end
371
482
  end
372
483
  end
373
484
  --- Helper function for printing out every tear flag that is turned on. Useful when debugging.
374
- function ____exports.logTearFlags(flags)
375
- ____exports.logFlags(flags, TearFlag, "tear")
485
+ function ____exports.logTearFlags(self, flags)
486
+ ____exports.logFlags(nil, flags, TearFlag, "tear")
376
487
  end
377
488
  --- Helper function for printing out every use flag that is turned on. Useful when debugging.
378
- function ____exports.logUseFlags(flags)
379
- ____exports.logFlags(flags, UseFlag, "use")
489
+ function ____exports.logUseFlags(self, flags)
490
+ ____exports.logFlags(nil, flags, UseFlag, "use")
380
491
  end
381
492
  --- Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
382
493
  -- the Isaac API).
383
- function ____exports.logUserdata(userdata)
494
+ function ____exports.logUserdata(self, userdata)
384
495
  if not isUserdata(nil, userdata) then
385
- ____exports.log("Userdata: [not userdata]")
496
+ ____exports.log(nil, "Userdata: [not userdata]")
386
497
  return
387
498
  end
388
499
  local metatable = getmetatable(userdata)
389
500
  if metatable == nil then
390
- ____exports.log("Userdata: [no metatable]")
501
+ ____exports.log(nil, "Userdata: [no metatable]")
391
502
  return
392
503
  end
393
504
  local classType = getIsaacAPIClassName(nil, userdata)
394
505
  if classType == nil then
395
- ____exports.log("Userdata: [no class type]")
506
+ ____exports.log(nil, "Userdata: [no class type]")
396
507
  else
397
- ____exports.log("Userdata: " .. classType)
508
+ ____exports.log(nil, "Userdata: " .. classType)
398
509
  end
399
- ____exports.logTable(metatable)
510
+ ____exports.logTable(nil, metatable)
400
511
  end
401
- function ____exports.logVector(vector, round)
512
+ function ____exports.logVector(self, vector, round)
402
513
  if round == nil then
403
514
  round = false
404
515
  end
405
516
  local vectorString = vectorToString(nil, vector, round)
406
- ____exports.log("Vector: " .. vectorString)
517
+ ____exports.log(nil, "Vector: " .. vectorString)
407
518
  end
408
519
  return ____exports