Extensions
Unofficial extensions to the Lua standard libraries
Status
Experimental: Functionality may change for any reason, without semantic versioning guarantees
Availability
Extensions are added to the existing global standard library tables. You can simply index them:
Debug Library
debug.dump
Prints a human-readable string representation of the given object. Mostly useful for dumping tables, but unsuitable for serialization purposes. The output format cannot be considered stable. Currently uses inspect internally, though this may change in the future.
Available since: v0.0.1Arguments |
---|
# | Name | Type | Fallback |
---|
| object | any | |
Return values |
---|
# | Name | Type |
---|
| stringifiedObject | string |
String Library
string.diff
Returns a string representing the difference between firstValue
and secondValue
. The exact format is subject to change.
Available since: v0.0.1Arguments |
---|
# | Name | Type | Fallback |
---|
| firstValue | string | |
| firstValue | string | |
Return values |
---|
# | Name | Type |
---|
| humanReadableDiff | string |
string.explode
Tokenizes the given inputString
based on a configurable delimiter
character, which is stripped from the output.
Available since: v0.0.1Arguments |
---|
# | Name | Type | Fallback |
---|
| inputString | string | |
| delimiter | string? | '%s' (whitespace) |
Return values |
---|
# | Name | Type |
---|
| tokens | table |
string.filesize
Returns a human-readable representation of the given fileSizeInBytes
using standard units. The exact format is subject to change.
Available since: v0.0.2Arguments |
---|
# | Name | Type | Fallback |
---|
| fileSizeInBytes | number | |
Return values |
---|
# | Name | Type |
---|
| formattedFileSize | string |
Table Library
table.contains
Returns true
if the given table
contains value
in the array part of the table, and false
otherwise. The dictionary part is ignored.
Available since: v0.0.1Arguments |
---|
# | Name | Type | Fallback |
---|
| table | table | |
| value | any | |
Return values |
---|
# | Name | Type |
---|
| isValuePresent | boolean |
Changelog
Version | What happened? |
---|
v0.0.2 | Added string.filesize |
v0.0.1 | Initial release |