event_object - Windower/packages GitHub Wiki

local event = require('event')

local event_object = event.new()

Event objects are used as a mechanism to call previously registered functions at certain in-game or Windower specific events.

An event object contains the following functions:



event_object:register

Registers a function to execute for a certain event. The parameters to the specified function will be whatever trigger passes in.

Definition

function event_object:register(fn : function)

Parameters

fn function

The function to execute. Should be able to receive whichever arguments are passed in by trigger.

Return

This function does not return any values.



event_object:unregister

Removes a function from the event registry for this event. After this, it will no longer be called by trigger.

Definition

function event_object:unregister(fn : function)

Parameters

fn function

The function to remove from the registry.

Return

This function does not return any values.



event_object:trigger

Executes all functions registered to this event.

Definition

function event_object:register(...args: any)

Parameters

...args any

Can be any type and number of arguments. Are passed to the registered functions in the same order. For regular events all caveats of serialization and deserialization apply. See the serializer documentation for more details.

Return

This function does not return any values.

⚠️ **GitHub.com Fallback** ⚠️