Engine.AddEventHandler

From Tomb Raider Mod Launcher Wiki
Jump to navigation Jump to search

Function

function bool Engine.AddEventHandler(eventName, handler);

Arguments

  • handler
    • The function to call when the event happens.

Description

This function will add a handler for the event you specify.

Returns

The function returns true if the handler was successfully added, false otherwise.

Example

// Add a handler for when a player joins the server to give them a nice greeting.
//
Engine.AddEventHandler("OnPlayerJoin",function(player){
	Engine.OutputChatBox("Hello " + Engine.GetPlayerName(player) + ", thanks for joining!",player);
});

Notes

Take care with event names as they could be case sensitive in future versions, currently as of 0.1.3 event names are not case sensitive. This could change in the future.