isaacscript-common 1.2.214 → 1.2.215
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/functions/log.d.ts +6 -1
- package/dist/functions/log.lua +24 -5
- package/package.json +1 -1
package/dist/functions/log.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ export declare function logColor(this: void, color: Color): void;
|
|
|
16
16
|
export declare function logDamageFlags(this: void, flags: int): void;
|
|
17
17
|
/** Helper function for printing out every entity (or filtered entity) in the current room. */
|
|
18
18
|
export declare function logEntities(this: void, includeBackgroundEffects: boolean, entityTypeFilter?: EntityType | int): void;
|
|
19
|
-
export declare function logEntity(this: void, entity: Entity): void;
|
|
20
19
|
/** Helper function for printing out every entity flag that is turned on. Useful when debugging. */
|
|
21
20
|
export declare function logEntityFlags(this: void, flags: int): void;
|
|
21
|
+
export declare function logEntityID(this: void, 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
|
* This is useful in combination with an early return when invoking the `error` function would be
|
|
@@ -59,6 +59,11 @@ export declare function logTearFlags(this: void, flags: int): void;
|
|
|
59
59
|
export declare function logTemporaryEffects(this: void, player: EntityPlayer): void;
|
|
60
60
|
/** Helper function for printing out every use flag that is turned on. Useful when debugging. */
|
|
61
61
|
export declare function logUseFlags(this: void, flags: int): void;
|
|
62
|
+
/**
|
|
63
|
+
* Helper function to enumerate all of the properties of a "userdata" object (i.e. an object from
|
|
64
|
+
* the Isaac API).
|
|
65
|
+
*/
|
|
66
|
+
export declare function logUserdata(this: void, userdata: unknown): void;
|
|
62
67
|
export declare function logVector(this: void, vector: Vector): void;
|
|
63
68
|
/**
|
|
64
69
|
* Converts every `isaacscript-common` function that begins with "log" to a global function.
|
package/dist/functions/log.lua
CHANGED
|
@@ -190,12 +190,12 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
|
|
|
190
190
|
____exports.log(("(" .. tostring(numMatchedEntities)) .. " total entities)")
|
|
191
191
|
end
|
|
192
192
|
end
|
|
193
|
-
function ____exports.logEntity(entity)
|
|
194
|
-
____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
|
|
195
|
-
end
|
|
196
193
|
function ____exports.logEntityFlags(flags)
|
|
197
194
|
____exports.logFlags(flags, EntityFlag, "entity")
|
|
198
195
|
end
|
|
196
|
+
function ____exports.logEntityID(entity)
|
|
197
|
+
____exports.log((((("Entity: " .. tostring(entity.Type)) .. ".") .. tostring(entity.Variant)) .. ".") .. tostring(entity.SubType))
|
|
198
|
+
end
|
|
199
199
|
function ____exports.logError(msg)
|
|
200
200
|
local errorMsg = "Error: " .. msg
|
|
201
201
|
____exports.log(errorMsg)
|
|
@@ -379,7 +379,11 @@ function ____exports.logTable(____table, parentTables)
|
|
|
379
379
|
____exports.log((((indentation .. "Key: ") .. tostring(key)) .. ", Value: ") .. tostring(value))
|
|
380
380
|
local valueType = type(value)
|
|
381
381
|
if valueType == "table" then
|
|
382
|
-
|
|
382
|
+
if key == "__class" then
|
|
383
|
+
____exports.log(indentation .. "(skipping enumerating this key to avoid infinite recursion)")
|
|
384
|
+
else
|
|
385
|
+
____exports.logTable(value, parentTables + 1)
|
|
386
|
+
end
|
|
383
387
|
end
|
|
384
388
|
numKeys = numKeys + 1
|
|
385
389
|
end
|
|
@@ -415,6 +419,20 @@ end
|
|
|
415
419
|
function ____exports.logUseFlags(flags)
|
|
416
420
|
____exports.logFlags(flags, UseFlag, "use")
|
|
417
421
|
end
|
|
422
|
+
function ____exports.logUserdata(userdata)
|
|
423
|
+
local userdataType = type(userdata)
|
|
424
|
+
if userdataType ~= "userdata" then
|
|
425
|
+
____exports.log("Userdata: [not userdata]")
|
|
426
|
+
return
|
|
427
|
+
end
|
|
428
|
+
local metatable = getmetatable(userdata)
|
|
429
|
+
if metatable == nil then
|
|
430
|
+
____exports.log("Userdata: [no metatable]")
|
|
431
|
+
return
|
|
432
|
+
end
|
|
433
|
+
____exports.log("Userdata: " .. metatable.__type)
|
|
434
|
+
____exports.logTable(metatable)
|
|
435
|
+
end
|
|
418
436
|
function ____exports.logVector(vector)
|
|
419
437
|
____exports.log(((("Vector: (" .. tostring(vector.X)) .. ", ") .. tostring(vector.Y)) .. ")")
|
|
420
438
|
end
|
|
@@ -425,7 +443,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
425
443
|
globals.logColor = ____exports.logColor
|
|
426
444
|
globals.logDamageFlags = ____exports.logDamageFlags
|
|
427
445
|
globals.logEntities = ____exports.logEntities
|
|
428
|
-
globals.
|
|
446
|
+
globals.logEntityID = ____exports.logEntityID
|
|
429
447
|
globals.logEntityFlags = ____exports.logEntityFlags
|
|
430
448
|
globals.logError = ____exports.logError
|
|
431
449
|
globals.logFlags = ____exports.logFlags
|
|
@@ -443,6 +461,7 @@ function ____exports.setLogFunctionsGlobal(self)
|
|
|
443
461
|
globals.logTearFlags = ____exports.logTearFlags
|
|
444
462
|
globals.logTemporaryEffects = ____exports.logTemporaryEffects
|
|
445
463
|
globals.logUseFlags = ____exports.logUseFlags
|
|
464
|
+
globals.logUserdata = ____exports.logUserdata
|
|
446
465
|
globals.logVector = ____exports.logVector
|
|
447
466
|
end
|
|
448
467
|
return ____exports
|