Utility.Event.Create

From Riftui Wiki

Jump to: navigation, search

Creates a custom event. Takes an identifier and an event path as parameters. Called with Create("Identifier", "The.Event.Path") the event table will end up at Event.Identifier.The.Event.Path, and will behave like a standard Rift event table in every way. Undefined behavior if given an identifier or a path that conflicts with a built-in Rift event or an existing addon event.

Contents

Signature

handle, eventTable = Utility.Event.Create(identifier, eventName)   -- function, table <- string, string

Parameters

eventName - The event's name. "." characters will be treated as hierarchy delimeters

identifier - The identifier of the addon creating this event. Can be the identifier of the addon you want to process the event or the addon that creates the event

Return Values

eventTable - The resulting event table

handle - A function used to trigger the event. Called with any selection of parameters, it will pass those parameters through to properly registered event handlers in order. Any errors caused by those event handlers will be caught and handled

Example

local MyAddon = {}
 
local return_handle = {}
return_handle.playerInfo = {} -- overkill, but we are going to Inspect everything about the player
return_handle.playerInfo, return_handle.playerInfoEventTable = Utility.Event.Create("MyAddon", "PlayerInfo")
 
function MyAddon:GetPlayerInfo()
	local detail = Inspect.Unit.Detail("player")
	return_handle.playerInfoEventTable = detail
	return
end
Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox