View Single Post
03/18/19, 05:45 AM   #1
Supportic
Join Date: Mar 2019
Posts: 24
Question Some LUA questions

Hey, I recently started messing around with Addons in ESO. I've built my first basic addon and there are still some questions left about structering code and XML fragments.

1. There are several ways to call functions

local example = function(x, y, z)
local example = Addon.function(x, y, z)
local example = Addon:function(x, y, z)

When do I use which call? Has it something to do if the call is in a external file?

2. When exactly do I need to tell the Event_Manager to shut down the listener and will it be harmful for the latency or FPS if I keep the listener alive for the whole time?

I know everytime when I do not need the listener anymore I can turn it off but is it necessary in terms of performance?

3. When is it usefull to make new sub folders with external .lua files except for languages and libs?

I can imagine that it's usefull for e.g. constants which you use through the whole addon but makes it sense to make a, lets say, combat sub folder with a combat.lua and a synergy.lua file in it which deal with all the combat stuff?

I've built a settings menu with a combat tracker ON/OFF option. When the tracker is ON, the [setFunc] should turn on the EM:RegisterForEvent - EVENT_PLAYER_COMBAT_STATE with a OnPlayerCombatState callback function which lays in a combat/combat.lua file. For some reason it cannot find the OnPlayerCombatState function. (Yes, I've put the files in the Addon.txt) On the other hand when I scamble everything into one file, everything works as intented.

4. Are there any tutorials regarding building a UI?

I just want to start with a simple resizable rectangle background with a close button on the top right hand side and some information in it like labels or controls (lists, dropdown boxes).
As far as I know you can build the UI without touching a XML file but it also works the other way around. What is the better option?

Thanks for the help in advance. Cheers

Last edited by Supportic : 03/18/19 at 05:56 AM.
  Reply With Quote