View Single Post
02/04/22, 04:14 AM   #15
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Files to load need to be written in the manifest txt file of your addon, hardcoded.
Just like any other lua or xml file.
If the files are stored in the data subtable it would be:
Code:
/data/esoui_constants_live.lua

You cannot dynamically add files to your addon via lua or ESOUI.
So your python script should enhance the txt file, if you want to add filenames dyanmically.



And you need to call the function names from any lua file then as long as they are global and not local.

You should add all that global functions and variables to 1 namespace (1 table with your unique addon's name) though so that they do not pollute the _G global table and accidently overwrite other adon's code!

e.g. in your addon's 1st file (1st lua file from the top in your manifest txt file) create 1 gobal at the top:
Lua Code:
  1. ESOPythonConstantsGlobal = {}

In each project lua file add at the top:
Lua Code:
  1. ESOPythonConstantsGlobal = ESOPythonConstantsGlobal or {} --will use given global or create an empty table if it was nil

And your functions and variables should be added to that global table then:

Lua Code:
  1. function ESOPythonConstantsGlobal.ActionBarSlotType_get_string(value)
  2.     return ACTIONBARSLOTTYPE_STRINGS[value] or tostring(value)
  3. }

You will be able to call the funcs like this from any of your project files then:
Lua Code:
  1. local myString = ESOPythonConstantsGlobal.ActionBarSlotType_get_string(ACTION_TYPE_ABILITY)

Last edited by Baertram : 02/04/22 at 04:19 AM.
  Reply With Quote