Skip to content

Class: EventHandler

Methods

NameDescription
:addListener(name,callback)
:emit(name,data)

Method declarations

Method: addListener

lua
function EventHandler:addListener(
    name,
    callback
) end

Parameters:

  • name (string) - Name of the event to listen to
  • callback (function) - Callback function that receives the event data as the first argument

Method: emit

lua
function EventHandler:emit(
    name,
    data
) end

Parameters:

  • name (string) - Name of the event to emit
  • data (any) - Data of the event