Assistance needed for registering events
So, I'm learning lua and the ESO API. I had an idea for a super simple addon, but getting just the basics down is proving to be a nightmare for me. I'm going to (embarrassingly) paste my code and ask that you guys tell me where I'm going wrong. What I'm looking to accomplish is getting the information of the items I'm looting, but I can't even get the dang loot event registered. And excuse the weird variable names--lots of poking and testing has been going on, as well as changing my addon idea a few times after learning of API restrictions. That and some of this is pasted examples from the esoui wiki.
When I gain loot, I want to see these items printed into chat via d() or something so I can start figuring this out. Thanks in advance for the help. PileOMobs.lua Code:
function lootReceived(receivedBy, itemName, quantity, itemSound, lootType, self) PileOMobs.xml Code:
<GuiXml> |
A good practice is to prefix your public function with the addon name. You will avoid few kinds of conflict. As example :
Quote:
And i think you missed a name on the second, and got a wrong controller. Quote:
Try to type it like the first, what will be like : Quote:
|
You're almost there but but not quite got it right.
Give this slight change a go Lua Code:
|
Quote:
For example: Lua Code:
When you fully define the tables, it's not as critical, since you can simply use the table name instead: Lua Code:
Where it's most useful is object-oriented programming style, where you have the same function with different objects and need self to differentiate between them. |
Thanks for the enlightenment !
|
All times are GMT -6. The time now is 05:38 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI