Engine.AddEventHandler

From Tomb Raider Mod Launcher Wiki
Revision as of 20:04, 15 August 2014 by Jack9267 (talk | contribs) (Created page with "== Function == <syntaxhighlight lang="javascript"> function bool Engine.AddEventHandler(eventName, handler); </syntaxhighlight> === Arguments === * eventName ** The name of...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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.