Skip to main content

LuaEvents.AddLocal(LuaBehaviour script, string eventName, function handler)

Like Add(), however this method adds the handler to the Local Event. Local event is an event only defined for individual Game Object and Script combination.

Parameters:

NameTypeDescription
scriptLuaBehaviourThe current running script object from LUA.script.
eventNamestringThe name of the local event. This will only defined with in GameObject + LuaScript combination. It will not cause collision with global events.
handlerfunctionThe handler function.

Returns:

typeDescription
LuaEventIdId unique to event name and attached handler

Usage

---@type LuaBehaviour
local script;

---@type string
local eventName;

---@type function
local handler;


local val0 = LuaEvents:AddLocal(script, eventName, handler)