Skip to content

Api > LuaEvents > AddLocal()


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:⚓︎

Name Type Description
script LuaBehaviour The current running script object from LUA.script.
eventName string The name of the local event. This will only defined with in GameObject + LuaScript combination. It will not cause collision with global events.
handler function The handler function.

Returns:⚓︎

type Description
LuaEventId Id 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)