Debug Functions
Functions
getElapsedTimeSince
▸ getElapsedTimeSince(time
, useSocketIfAvailable?
): int
Helper function to get the amount of elapsed time for benchmarking / profiling purposes.
For more information, see the documentation for the getTime
helper function.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
time | int | float | undefined | The milliseconds (int) or fractional seconds (float). |
useSocketIfAvailable | boolean | true | Optional. Whether to use the socket.gettime method, if available. Default is true. If set to false, the Isaac.GetTime() method will always be used. |
Returns
int
Defined in
packages/isaacscript-common/src/functions/debugFunctions.ts:13
getTime
▸ getTime(useSocketIfAvailable?
): int
| float
Helper function to get the current time for benchmarking / profiling purposes.
The return value will either be in seconds or milliseconds, depending on if the "--luadebug" flag is turned on.
If the "--luadebug" flag is present, then this function will use the socket.gettime
method,
which returns the epoch timestamp in seconds (e.g. "1640320492.5779"). This is preferable over
the more conventional Isaac.GetTime
method, since it has one extra decimal point of precision.
If the "--luadebug" flag is not present, then this function will use the Isaac.GetTime
method,
which returns the number of milliseconds since the computer's operating system was started (e.g.
"739454963").
Parameters
Name | Type | Default value | Description |
---|---|---|---|
useSocketIfAvailable | boolean | true | Optional. Whether to use the socket.gettime method, if available. Default is true. If set to false, the Isaac.GetTime() method will always be used. |
Returns
int
| float
Defined in
packages/isaacscript-common/src/functions/debugFunctions.ts:38
getTraceback
▸ getTraceback(this
): string
Helper function to get a stack trace.
This will only work if the --luadebug
launch option is enabled. If it isn't, then a error
string will be returned.
Parameters
Name | Type |
---|---|
this | void |
Returns
string
Defined in
packages/isaacscript-common/src/functions/debugFunctions.ts:66
isLuaDebugEnabled
▸ isLuaDebugEnabled(): boolean
Players can boot the game with an launch option called "--luadebug", which will enable additional functionality that is considered to be unsafe. For more information about this flag, see the wiki: https://bindingofisaacrebirth.fandom.com/wiki/Launch_Options
When this flag is enabled, the global environment will be slightly different. The differences are documented here: https://wofsauge.github.io/IsaacDocs/rep/Globals.html
This function uses the package
global variable as a proxy to determine if the "--luadebug" flag
is enabled.
Note that this function will return false if the Racing+ sandbox is enabled, even if the
"--luadebug" flag is really turned on. If checking for this case is needed, check for the
presence of the sandboxGetTraceback
function.
Returns
boolean
Defined in
packages/isaacscript-common/src/functions/debugFunctions.ts:96
traceback
▸ traceback(this
): void
Helper function to log a stack trace to the "log.txt" file, similar to JavaScript's
console.trace
function.
This will only work if the --luadebug
launch option is enabled. If it isn't, then a error
string will be logged.
Parameters
Name | Type |
---|---|
this | void |
Returns
void
Defined in
packages/isaacscript-common/src/functions/debugFunctions.ts:109