C H A P T E R  4


Working with Game Events

This chapter is about event handlers and how to use them. An event handler is a function that is called by the game every time a specific event occurs. World of Warcraft provides a variety of events, ranging from clicks on UI elements to combat-related events. So what we need to do is tell the game that we are interested in an event and provide an event-handler function that should be called when the event occurs. Such a function is also called a callback function.

We will build three example mods in this chapter, the first of which will provide mouse-over tooltips for item, quest, and spell links in ...

Get Beginning Lua with World of Warcraft Addons now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.