Introduction

This tutorial was made by ziandra, originally found here.

Tutorial 2

Base files :

Finished files :

Exercise two is a bit more complicated. Here we see how to hook and attach lua code to game events.

Modules often need to do some initialization code so will hook the OnLoad event. Let's modify gorp.xml to handle that. Our new gorp.xml becomes

[snip] replaced by the external file Interface\FrameXML\gorp.xml.

So, when the module loads it calls the LUA function "Gorp_OnLoad" that I will define.
You can put any lua code you like there. I just choose to call a function. You could just as easily have done the message printing in the xml file and forgone the need of the lua file, but I am showing a more general framework.

Next in gorp.lua we create the Gorp_OnLoad function and ... well, do very little. gorp.lua now looks like

[snip] replaced by the external file Interface\Framelua\gorp.lua.

Restart the game, or go into the console and type ReloadUI and you will see

Gorp OnLoad handler

in your combat window.

Type /gorp and you will see

Hello World

in your combat window.

Contacting me

To contact me, mail me at k!!!@fukt!!!.bth.se (remove the exclamation marks).