Hi again all,
The title says everything.
I was trying to create a configuration table for my castbar and just got a question regarding table construction.
Let's say I have a simple table like this:
Lua Code:
G["castbar"] = {
["player"] = {
["width"] = 350,
["height"] = 35,
["point"] = {"CENTER", UIParent, "CENTER", 250, -200},
["iconSize"] = 35,
["spacing"] = 2,
},
}
As you can see, height and iconSize have a same value and this is because I would like the icon to be the same size as the castbar's height.
Of course, I could do something like
Lua Code:
G["castbar"] = {
["player"] = {
["width"] = 350,
["height"] = 35,
["point"] = {"CENTER", UIParent, "CENTER", 250, -200},
["spacing"] = 2,
},
}
G["castbar"]["player"]["iconSize"] = G["castbar"]["player"]["height"];
and this will definitely work without any issues.
However, as I add target's castbar, targettarget's castbar, party1's castbar and so on, this would look ugly and would be complex for me to manage with.
e.g:
Lua Code:
G["castbar"] = {
["player"] = {
["width"] = 350,
["height"] = 35,
["point"] = {"CENTER", UIParent, "CENTER", 250, -200},
["spacing"] = 2,
},
["target"] = {
["width"] = G["unitframe"]["target"]["width"],
["height"] = 20,
["point"] = {"TOP", UIParent, "BOTTOM", 0, 200},
["iconSize"] = 20,
},
}
G["castbar"]["player"]["iconSize"] = G["castbar"]["player"]["height"];
G["castbar"]["target"]["spacing"] = G["castbar"]["player"]["spacing"];
.
.
.
I also tried something like the following and this doesn't seem to be working. I'm guessing that this is because the table G["castbar"] does not exist yet, since it is on the way of its construction.
Lua Code:
G["castbar"] = {
["player"] = {
["width"] = 350,
["height"] = 35,
["point"] = {"CENTER", UIParent, "CENTER", 250, -200},
["iconSize"] = G["castbar"]["player"]["height"],
["spacing"] = 2,
},
}
To gain some idea, I have gone through the official references, but could have not found anything close to this...
Would there be any possible approach to achieve something similar to the above?
Thank you.