Appearance
CallbackRegistry
Inherits: Class
Methods
Add
lua
function CallbackRegistry:Add(func, key)Adds a callback into the registry.
Parameters:
| Name | Type | Description |
|---|---|---|
func | F | |
key | string | The key (required if and only if the registry was created via NewWithKeys()) |
Call
lua
function CallbackRegistry:Call(key, ...)
-> anyCalls a specific registered callback by its key and passes through its returns. NOTE: This registry must have been created via NewWithKeys() and without an execution time label.
Parameters:
| Name | Type | Description |
|---|---|---|
key | string | The key |
... | params<F> | Arguments to pass to the callback |
Returns:
| Type | Description |
|---|---|
any |
CallAll
lua
function CallbackRegistry:CallAll(...)Calls all registered callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
... | params<F> | Arguments to pass to the callbacks |
HasCallback
lua
function CallbackRegistry:HasCallback(funcOrKey)Checks if a callback is already within the registry.
Parameters:
| Name | Type | Description |
|---|---|---|
funcOrKey | F | string | The callback function for registries created via NewList() or the key if created via NewWithkeys() |
IsEmpty
lua
function CallbackRegistry:IsEmpty()
-> booleanReturns whether or not the registry is empty.
Returns:
| Type | Description |
|---|---|
boolean |
Remove
lua
function CallbackRegistry:Remove(funcOrKey)Removes a callback from the registry.
Parameters:
| Name | Type | Description |
|---|---|---|
funcOrKey | F | string | The callback function for registries created via NewList() or the key if created via NewWithkeys() |
Wipe
lua
function CallbackRegistry:Wipe()Removes all callbacks from the registry.
_DoCallback
lua
function CallbackRegistry:_DoCallback(key, func, ...)Parameters:
| Name | Type | Description |
|---|---|---|
key | `` | |
func | `` | |
... | `` |
__init
lua
function CallbackRegistry:__init(hasKeys, executionTimeLabel)Parameters:
| Name | Type | Description |
|---|---|---|
hasKeys | `` | |
executionTimeLabel | `` |
Functions
NewList
lua
function CallbackRegistry.NewList(executionTimeLabel)
-> CallbackRegistryCreates a new callback registry which maintains a list of callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
executionTimeLabel | string |
Returns:
| Type | Description |
|---|---|
CallbackRegistry |
NewWithKeys
lua
function CallbackRegistry.NewWithKeys(executionTimeLabel)
-> CallbackRegistryCreates a new callback registry which maintains a keyed table of callbacks.
Parameters:
| Name | Type | Description |
|---|---|---|
executionTimeLabel | string |
Returns:
| Type | Description |
|---|---|
CallbackRegistry |