WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   c stack overflow (moving ComboPointPlayerFrame) (https://www.wowinterface.com/forums/showthread.php?t=56148)

Cie 04-13-18 07:53 AM

c stack overflow (moving ComboPointPlayerFrame)
 
Hi,

im moving the Rogue Combo Point Bar like this:

Lua Code:
  1. local function yOffset(Frame,y)
  2.     local P = { Frame:GetPoint() }
  3.     Frame:SetPoint(P[1], P[2], P[3], P[4],y)
  4. end
  5.  
  6. hooksecurefunc(ComboPointPlayerFrame,"SetPoint",function(ComboPointPlayerFrame) yOffset(ComboPointPlayerFrame,91) end)

however i get the following error:

Code:

Message: C stack overflow
Time: 04/13/18 15:51:24
Count: 1
Stack: C stack overflow
[C]: ?
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
.lua:87: in function <...lua:6>
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
.lua:87: in function <...lua:6>
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
.lua:87: in function <...lua:6>
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
...
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
.lua:87: in function <...lua:6>
[C]: in function `SetPoint'
.lua:84: in function <...lua:1>
.lua:87: in function <...lua:6>
[C]: in function `SetPoint'
Interface\FrameXML\ComboFramePlayer.lua:35: in function `Setup'
Interface\FrameXML\ClassPowerBar.lua:56: in function `OnEvent'
Interface\FrameXML\ComboFramePlayer.lua:27: in function <Interface\FrameXML\ComboFramePlayer.lua:21>

its working fine though, but i cant fix it, whats the exact problem here?

Kanegasi 04-13-18 08:14 AM

It’s recursive. You attached a function that calls SetPoint to SetPoint itself. Find another function to hook to.

myrroddin 04-13-18 09:01 AM

Yep. You are using SetPoint on each pixel of the y axis (same would be true if you also did it on the x axis). Try setting the frame to movable and moving or sizing. Once the frame has stopped moving, then GetPoint for the new position and save that to your SVs.

Kakjens 04-13-18 04:49 PM

Shouldn't this work:
Lua Code:
  1. local needs_to_setpoint = true
  2. local function yOffset(Frame,y)
  3.     if needs_to_setpoint
  4.         needs_to_setpoint = false
  5.         local P = { Frame:GetPoint() }
  6.         Frame:SetPoint(P[1], P[2], P[3], P[4],y)
  7.     end
  8.     needs_to_setpoint = true
  9. end
  10.  
  11. hooksecurefunc(ComboPointPlayerFrame,"SetPoint",function(ComboPointPlayerFrame) yOffset(ComboPointPlayerFrame,91) end)
?

Cie 04-13-18 11:09 PM

i just anchored it to the playerframe , didnt worked the first time ive tried it , but it does now. well :banana:


All times are GMT -6. The time now is 05:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI