API
- class LibTSMCore
-
staticmethod NewComponent(name:
string):LibTSMComponent Creates a new component.
- Parameters:
name (
string) – The name of the component
-
staticmethod SetTimeFunction(timeFunc: fun():
number) Sets the time function.
- Parameters:
timeFunc (fun():
number) – A function which returns the time with high precision
- staticmethod LoadAll()
Loads all modules.
-
staticmethod UnloadAll(maxTime:
number):boolean Unloads all modules.
- Parameters:
maxTime (
number) – The max time before aborting early
-
staticmethod ModuleInfoIterator(): (
fun():number,string,string,number,number,
nil,
number
) Returns an iterator over all available modules.
- Returns:
_1 (fun():
number,string,string,number,number) – Iterator with fields: index, componentName, modulePath, loadTime, unloadTime
-
staticmethod NewComponent(name:
- class LibTSMComponent
-
Init(self:
LibTSMComponent, path: <T>): <T:LibTSMModule> Creates a new module and makes it available to other components.
- Parameters:
path (<
T>) – The path of the module
-
InitInternal(self:
LibTSMComponent, path: <T>): <T:LibTSMModule> Creates a new module which is only available internally within the component.
- Parameters:
path (<
T>) – The path of the module
-
DefineClassType(
self:LibTSMComponent,
name: <T>,
parentClass?:Class,
...: "ABSTRACT"
): <T:Class> Creates a new class type and makes it available to other components.
- Parameters:
name (<
T>) – The name of the classparentClass? (
Class) – The parent class... ("ABSTRACT") – Properties to define the class with
-
DefineInternalClassType(
self:LibTSMComponent,
name: <T>,
parentClass?:Class,
...: "ABSTRACT"
): <T:Class> Creates a new class type which is only available internally within the component.
- Parameters:
name (<
T>) – The name of the classparentClass? (
Class) – The parent class... ("ABSTRACT") – Properties to define the class with
-
Include(self:
LibTSMComponent, path: <T>): <T> Returns an existing module.
- Parameters:
path (<
T>) – The path of the module
-
IncludeClassType(self:
LibTSMComponent, name: <T>): <T> Returns a class type.
- Parameters:
name (<
T>) – The name of the class
-
From(self:
LibTSMComponent, name:string):LibTSMComponentReference Retrieves a component which the current component depends on.
- Parameters:
name (
string) – The name of the component
-
AddDependency(self:
LibTSMComponent, name:string):LibTSMComponent Adds a component as a dependency of the current component.
- Parameters:
name (
string) – The name of the component
-
Init(self:
- class LibTSMModule
-
protected OnModuleLoad(self:
LibTSMModule, func: fun()) Registers the function be called when the module is loaded.
- Parameters:
func (fun()) – The function to call
-
protected OnModuleUnload(self:
LibTSMModule, func: fun()) Registers the function be called when the module is unloaded.
- Parameters:
func (fun()) – The function to call
-
protected OnModuleUnloadLate(self:
LibTSMModule, func: fun()) Registers the function be called when the module is unloaded as late as possible in the process.
- Parameters:
func (fun()) – The function to call
-
protected OnModuleLoad(self: