Skip to main content

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.dump({ 1, 2, 3 })

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.1
Arguments
#NameTypeFallback
objectany
Return values
#NameType
stringifiedObjectstring

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.1
Arguments
#NameTypeFallback
firstValuestring
firstValuestring
Return values
#NameType
humanReadableDiffstring

string.explode

Tokenizes the given inputString based on a configurable delimiter character, which is stripped from the output.

Available since: v0.0.1
Arguments
#NameTypeFallback
inputStringstring
delimiterstring?'%s' (whitespace)
Return values
#NameType
tokenstable

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.2
Arguments
#NameTypeFallback
fileSizeInBytesnumber
Return values
#NameType
formattedFileSizestring

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.1
Arguments
#NameTypeFallback
tabletable
valueany
Return values
#NameType
isValuePresentboolean

Changelog

VersionWhat happened?
v0.0.2Added string.filesize
v0.0.1Initial release