EventRegistry


A registry for events. Used to register and retrieve event classes by ID.


Constructor






Methods


EventRegistry:create(id: string, data: table|nil)

Create a new event instance of the given ID, using the provided data.

@param id — The ID of the event.

@param data — The data to pass to the event constructor.

@return The — created event instance.

Arguments:

id: string

The ID of the event.

data: table|nil

The data to pass to the event constructor.

Returns:

The: Event

created event instance.



EventRegistry:get(id: string)

Get the constructor function registered with the given ID.

@param id — The ID of the event.

Arguments:

id: string

The ID of the event.

Returns:

1: unknown


EventRegistry:has(id: string)

Check if an event with the given ID is registered.

@param id — The ID of the event.

Arguments:

id: string

The ID of the event.

Returns:

1: boolean


EventRegistry:register(id: string, constructor: fun( any)Event)

Register a new event with the given ID.

@param id — The ID of the event.

@param constructor — A constructor function that takes event data and returns an event instance.

Arguments:

id: string

The ID of the event.

constructor: fun( any)Event

A constructor function that takes event data and returns an event instance.




Fields



Undocumented