Skip to content

API

Functions

ConstructWithTable

lua
function LibTSMClass.ConstructWithTable(tbl, class, ...)
  -> <T>

Constructs a class from an existing table, preserving its keys.

Parameters:

NameTypeDescription
tbltableThe table with existing keys to preserve
classTThe class to construct
...anyArguments to pass to the constructor

Returns:

TypeDescription
<T>

DefineClass

lua
function LibTSMClass.DefineClass(name, superclass, ...)
  -> <T:Class>

Defines a new class.

Parameters:

NameTypeDescription
name<T>The name of the class
superclassPThe superclass
...ClassPropertiesProperties to define the class with

Returns:

TypeDescription
<T:Class>

GetDebugInfo

lua
function LibTSMClass.GetDebugInfo(instStr, maxDepth, tableLookupFunc)
  -> string?

Gets instance properties from an instance string for debugging purposes.

Parameters:

NameTypeDescription
instStrstringThe string representation of the instance
maxDepthnumberThe maximum depth to recurse into tables
tableLookupFuncfun(tbl: table): string?A lookup function which is used to get debug information for an unknown table

Returns:

TypeDescription
string?The properties dumped as a multiline string