Thread Tools Display Modes
10-10-18, 12:26 AM   #1
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
'My' ClassPower element seems to crash with '/fstack'

Hi all,

I've not been touching my Class Power element and even '/fstack' for ages.

Just today I've accidentally pressed the hotkey for '/fstack' command and it gave me the following error.

Code:
2x invalid key to 'next'
[C]: in function `SetFrameStack'
...eBlizzard_DebugTools\Blizzard_DebugTools-1.0.lua:673: in function `FrameStackTooltip_Toggle'
FrameXML\ChatFrame.lua:2356: in function `?'
FrameXML\ChatFrame.lua:4734: in function `ChatEdit_ParseText'
FrameXML\ChatFrame.lua:4396: in function `ChatEdit_SendText'
FrameXML\ChatFrame.lua:2884: in function <FrameXML\ChatFrame.lua:2877>
[C]: in function `UseAction'
FrameXML\SecureTemplates.lua:345: in function `handler'
FrameXML\SecureTemplates.lua:623: in function `SecureActionButton_OnClick'
FrameXML\MultiActionBars.lua:24: in function `MultiActionButtonUp'
[string "MULTIACTIONBAR3BUTTON5"]:4: in function <[string "MULTIACTIONBAR3BUTTON5"]:1>

Locals:
(*temporary) = FrameStackTooltip {
 0 = <userdata>
 showRegions = true
 TopOverlay = <unnamed> {
 }
 showHidden = false
 default = 1
 BottomOverlay = <unnamed> {
 }
 showAnchors = true
 nextUpdate = 0
 commandKeys = <table> {
 }
}
(*temporary) = false
(*temporary) = true
(*temporary) = <unnamed> {
 0 = <userdata>
}
(*temporary) = <unnamed> {
 1 = <unnamed> {
 }
 2 = <unnamed> {
 }
 3 = <unnamed> {
 }
 4 = <unnamed> {
 }
 5 = <unnamed> {
 }
 6 = <unnamed> {
 }
 7 = <unnamed> {
 }
 8 = <unnamed> {
 }
 9 = <unnamed> {
 }
 10 = <unnamed> {
 }
 0 = <userdata>
 ClassPowerEnable = <function> defined @!MyEngine\lib\oUF\elements\classpower.lua:234
 ForceUpdate = <function> defined @!MyEngine\lib\oUF\elements\classpower.lua:229
 ClassPowerDisable = <function> defined @!MyEngine\lib\oUF\elements\classpower.lua:247
 isEnabled = true
 __max = 5
 __owner = oUF_CoG {
 }
}
(*temporary) = "5"
So, I've been debugging quite a while and found that it is causing because of my Class Power element code.

Lua Code:
  1. -- Class Power
  2. local classPower = CreateFrame("Frame", nil, UIParent);
  3. classPower:SetWidth(256);
  4. classPower:SetHeight(36);
  5. classPower:SetPoint("CENTER");
  6.  
  7. for i = 1, 10 do
  8.     local bar = CreateFrame("StatusBar", nil, classPower);
  9.     bar:SetSize(36, 36);
  10.  
  11.     if i == 1 then
  12.         bar:SetPoint("LEFT", classPower, "LEFT");
  13.     else
  14.         bar:SetPoint("LEFT", classPower[i - 1], "RIGHT", 3, 0);
  15.     end
  16.  
  17.     classPower[i] = bar;
  18. end
  19.  
  20. self.ClassPower = classPower;

I have also tested with example code provided on class power and it did not cry for such error

Could anyone please explain me why and how this error is occurring?

Thank you!

-- Edit #1

Basically this occurs when at least ONE class power bar (one combo point) is visible.

Last edited by Lyak : 10-10-18 at 06:31 AM.
  Reply With Quote
10-10-18, 06:54 AM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Give names to your bars.

Lua Code:
  1. local classPower = CreateFrame("Frame", nil, UIParent);
  2. classPower:SetWidth(256);
  3. classPower:SetHeight(36);
  4. classPower:SetPoint("CENTER");
  5.  
  6. for i = 1, 10 do
  7.     local bar = CreateFrame("StatusBar", "ClassPowerBar" .. i, classPower);
  8.     bar:SetSize(36, 36);
  9.  
  10.     if i == 1 then
  11.         bar:SetPoint("LEFT", classPower, "LEFT");
  12.     else
  13.         bar:SetPoint("LEFT", classPower[i - 1], "RIGHT", 3, 0);
  14.     end
  15.  
  16.     classPower[i] = bar;
  17. end
  18.  
  19. frame.ClassPower = classPower;

In general, names aren't mandatory, but sometimes, like in this particular case, /fstack is very very picky.

-- edit #1

When you're "nesting" one frame table inside another one like so: frame[1] = anotherFrame, you must give anotherFrame a proper name, it's only needed when you index w/ numbers, if you do something like this: frame["1"] = anotherFrame, you can leave anotherFrame nameless.

Once again, it only applies to "nesting" inside other frames. For example, doing something like this won't cause any issues:
Lua Code:
  1. local classPower = CreateFrame("Frame", nil, UIParent);
  2. classPower:SetWidth(256);
  3. classPower:SetHeight(36);
  4. classPower:SetPoint("CENTER");
  5.  
  6. local container = {};
  7.  
  8. for i = 1, 10 do
  9.     local bar = CreateFrame("StatusBar", nil, classPower);
  10.     bar:SetSize(36, 36);
  11.  
  12.     if i == 1 then
  13.         bar:SetPoint("CENTER");
  14.     else
  15.         bar:SetPoint("LEFT", container[i - 1], "RIGHT", 3, 0);
  16.     end
  17.  
  18.     container[i] = bar;
  19. end
  20.  
  21. frame.ClassPower = container;
__________________

Last edited by lightspark : 10-10-18 at 07:15 AM.
  Reply With Quote
10-11-18, 12:48 AM   #3
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Hi lightspark,

First of all, Thank you so much and I really appreciate your help!

I gave each of those elements a name to avoid '/fstack' crying

Yeap, it's definitely working

Lua Code:
  1. -- Class Power
  2. local classPower = CreateFrame("Frame", "$parentClassPower", self);
  3. classPower:SetHeight(setting.height);
  4. classPower:CustomSetPoint(setting.point);
  5.  
  6. for i = 1, 10 do
  7.     local bar = CreateFrame("StatusBar", "$parentBar" .. i, classPower);
  8.     bar:SetStatusBarTexture(LSM:Fetch("statusbar", setting.texture));
  9.     bar:SetWidth(setting.width);
  10.     bar:SetPoint("TOP");
  11.     bar:SetPoint("BOTTOM");
  12.  
  13.     bar:SetTemplate();
  14.     bar:SetBackground();
  15.  
  16.     if i == 1 then
  17.         bar:SetPoint("LEFT");
  18.     else
  19.         bar:SetPoint("LEFT", classPower[i - 1], "RIGHT", 3, 0);
  20.     end
  21.  
  22.     classPower[i] = bar;
  23. end
  24.  
  25. classPower.UpdateColor = ClassPowerUpdateColor;
  26. classPower.PostUpdate = ClassPowerPostUpdate;
  27.  
  28. self.ClassPower = classPower;

So, I do get that it's happening because of nested frames, with numeric as their key instead of string for inner frames, where inner frames do not have their unique name.

But why...?

I had a look at Blizzard_DebugTools-1.0.lua as stated on a error log, but it's totally out of my field
  Reply With Quote
10-11-18, 02:58 AM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Lyak View Post
But why...?

I had a look at Blizzard_DebugTools-1.0.lua as stated on a error log, but it's totally out of my field
Why do you even care about it? :P

The issue is in the backend, C code, it might be a function that iterates through or does something w/ userdata, which is frame[0], but then it tries to do the same w/ unnamed frames: frame[1], frame[2], etc. It might be something else.

Sitting here and guessing is a waste of time.
__________________
  Reply With Quote
10-11-18, 04:50 AM   #5
Lyak
A Cyclonian
Join Date: Jul 2018
Posts: 46
Originally Posted by lightspark View Post
Why do you even care about it? :P

The issue is in the backend, C code, it might be a function that iterates through or does something w/ userdata, which is frame[0], but then it tries to do the same w/ unnamed frames: frame[1], frame[2], etc. It might be something else.

Sitting here and guessing is a waste of time.
Aight!

Time to proceed forward then
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » 'My' ClassPower element seems to crash with '/fstack'

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off