Skip to main content

Callback

Bind / Unbind event handlers (callbacks).

Functions

Bind

Callback.Bind(
type: CallbackType,
callback: CallbackSignatures,
priority: number - integer
) number

ArgumentTypeDescription
typeCallbackTypeCallback type.
callbackCallbackSignaturesCallback function. Check CallbackSignatures for examples.
prioritynumber - integerCallback priority. 0 by default.

Binds specified callback functions and returns unique handler.


Unbind

Callback.Unbind( handle: number ) void

ArgumentTypeDescription
handlenumberCallback handle to unbind.

Unbind callback by unique handler.


Examples

Basic example of binding OnTick event handler and unbinding it.

local onTickHandle = Callback.Bind(CallbackType.OnTick, function()
-- ...
end)

if onTickHandle then
Callback.Unbind(onTickHandle)
end