Ah...not quite. You're doing a couple of things here that may cause things to act in a way you don't expect them to.
Lua Code:
local addon, ns = ...
local name, ns = ...
local cfg = CreateFrame('Frame')
local _, class = UnitClass('player')
local cfg = {}
What you are doing here is creating two variables (addon and name) that hold the same information (the Addon Name). Then with cfg, first you are creating it as a frame, then re-defining it as a table.
Try this.
Config file:
Lua Code:
local addonName, ns = ...
local _, class = UnitClass('player')
local mediaPath = "Interface\\AddOns\\oUF_Kygo\\Media\\"
local cfg = {
texture = mediaPath.."normTex2.tga",
bgFile = mediaPath.."backdrop",
edgeFile = mediaPath.."backdrop_edge",
Icon = mediaPath.."Neal_border",
CPoint = mediaPath.."NCPoint",
font = "Interface\\AddOns\\oUF_Kygo\\Media\\Fonts\\ExpresswayRg.ttf",
fontsize = 10,
fontflag = "OUTLINE, MONOCHROME", -- Font flags should be in capitals and separated by a comma
ClassPowerText = {
Priest = {26/255, 160/255, 255/255}, --Mana
Shaman = {26/255, 160/255, 255/255}, -- Mana
Warlock = {26/255, 160/255, 255/255}, -- Mana
Paladin = {26/255, 160/255, 255/255}, -- Mana
MonkMistweaver = {26/255, 160/255, 255/255}, --How to check if monk is MW or not status: Unknown atm
Mage = {26/255, 160/255, 255/255}, -- Mana
DruidRestoBalance = {26/255, 160/255, 255/255}, -- Mana
Warrior = {255/255, 26/255, 48/255}, -- Rage
DruidGuardian = {255/255, 26/255, 48/255}, --Rage
Hunter = {255/255, 128/255, 64/255}, -- Focus
Rogue = {255/255, 225/255, 26/255}, -- Energy
DruidFeral = {255/255, 225/255, 26/255}, -- Energy
DeathKnight = {0.00, 0.82, 1.00}, -- Runic Power
}
ns.cfg = cfg
Then at the top of the files where you need to access this information
Lua Code:
local addonName, ns = ...
local cfg = ns.cfg -- if you want to save yourself some typing and reference the table as cfg.[i]KeyName[/i]. Otherwise you could just access the values using ns.cfg.[i]keyName[/i]
powerText:SetFont(cfg.font, cfg.fontsize, cfg.fontflag) would then work. It wasn't previously because the way you had the flags set.
The way I think of it is :
Config File
- Get Access to the table accessible to the whole addon - (done by assigning it to 'ns')
- Assemble the information I want to put into the table
- Add the information to the table (ns.cfg = cfg)
Then in each other file you need to get that information.
- Get access to the table (assigning it to 'ns' again)
- [Optional] Assign the ns.cfg part of the table to a new variable to make typing out table references easier.
- Use or change the information as required.
That is just the way I think of it for it to make sense to me and it is a very simplistic view of it. Phanx and others could probably go into more detail for you if you wished.