WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   Errors using oUF for raids (https://www.wowinterface.com/forums/showthread.php?t=41733)

Safturento 11-04-11 11:50 AM

Errors using oUF for raids
 
I'm currently working on an oUF layout, and am getting a lua error upon entering a raid or battleground. Most of the time the error looks like this:
Code:

1x table: 27A45838
nil

Locals:
nil

But if I don't reload my UI for a while and continue doing BGs, I'll eventually get an error saying that 'unit' is nil (unit being the second parameter of my layout function). A few of my raid frames also fail to show up. They spawn, because the ones that do show up are anchored to them properly, but it's as if it's not setting the layout for them. Does anyone know what would cause this, and how to fix it?

edit: I'm using oUF version 1.5.15

edit2: Here's my layout file

haste 11-04-11 01:51 PM

How does the default Lua error frame display the error?

Safturento 11-04-11 02:59 PM

Code:

Message: Interface\AddOns\stUnitFrames\layout.lua:12: attempt to concatenate local 'unit' (a nil value)
Time: 11/04/10 15:55:49
Count: 17
Stack: [C]: ?
[C]: ?
Interface\FrameXML\RestrictedFrames.lua:604: in function <Interface\FrameXML\RestrictedFrames.lua:603>
Interface\FrameXML\RestrictedFrames.lua:742: in function `CallMethod'
[string "                local header = self:GetParent()..."]:52: in function <[string "                local header = self:GetParent()..."]:1>
(tail call): ?
[C]: ?
Interface\FrameXML\RestrictedExecution.lua:441: in function <Interface\FrameXML\RestrictedExecution.lua:412>
Interface\FrameXML\SecureGroupHeaders.lua:108: in function `SetupUnitButtonConfiguration'
Interface\FrameXML\SecureGroupHeaders.lua:158: in function <Interface\FrameXML\SecureGroupHeaders.lua:115>
Interface\FrameXML\SecureGroupHeaders.lua:457: in function <Interface\FrameXML\SecureGroupHeaders.lua:381>
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:100: in function <Interface\FrameXML\SecureStateDriver.lua:95>
Interface\FrameXML\SecureStateDriver.lua:127: in function <Interface\FrameXML\SecureStateDriver.lua:119>

Line 12:
Code:

if not self or not unit then print("self: "..self..";  unit"..unit) return end
Whenever I remove that line, I get this error:
Code:

Message: Interface\AddOns\stUnitFrames\layout.lua:12: Wrong object type for member function
Time: 11/04/10 16:00:59
Count: 1
Stack: [C]: ?
[C]: ?
Interface\FrameXML\RestrictedFrames.lua:604: in function <Interface\FrameXML\RestrictedFrames.lua:603>
Interface\FrameXML\RestrictedFrames.lua:742: in function `CallMethod'
[string "                local header = self:GetParent()..."]:52: in function <[string "                local header = self:GetParent()..."]:1>
(tail call): ?
[C]: ?
Interface\FrameXML\RestrictedExecution.lua:441: in function <Interface\FrameXML\RestrictedExecution.lua:412>
Interface\FrameXML\SecureGroupHeaders.lua:108: in function `SetupUnitButtonConfiguration'
Interface\FrameXML\SecureGroupHeaders.lua:158: in function <Interface\FrameXML\SecureGroupHeaders.lua:115>
Interface\FrameXML\SecureGroupHeaders.lua:392: in function <Interface\FrameXML\SecureGroupHeaders.lua:381>
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:100: in function <Interface\FrameXML\SecureStateDriver.lua:95>
Interface\FrameXML\SecureStateDriver.lua:127: in function <Interface\FrameXML\SecureStateDriver.lua:119>

Line 12 in that error being
Code:

self:RegisterForClicks("AnyUp")
From what I can see, it looks as if the header is trying to set the layout for a frame, but is only giving it the frame, and not the unit.

edit: Also, when I run a script to print GetObjectType of one of the frames that bugged out, it does show the object type as a Button, just like the frames that do work.

haste 11-04-11 03:07 PM

The unit variable isn't always set on headers. oUF only does it when it is able to figure out what the layout is trying to spawn.

Safturento 11-04-11 03:14 PM

Quote:

Originally Posted by haste (Post 246824)
The unit variable isn't always set on headers. oUF only does it when it is able to figure out what the layout is trying to spawn.

I guess adding
Code:

        self:SetActiveStyle("stUnitFrames")
fixes that then. :P Thank you. Just another quick question, I'm assuming that there's no built in function with oUF to kill the blizzard raid frames?

haste 11-04-11 03:18 PM

That's correct. I don't really replace the raid manager part of the UI, so I don't remove it. Earlier there weren't even slash commands for some of the functionality -- that might have changed now however...

Safturento 11-04-11 03:44 PM

Quote:

Originally Posted by haste (Post 246827)
That's correct. I don't really replace the raid manager part of the UI, so I don't remove it. Earlier there weren't even slash commands for some of the functionality -- that might have changed now however...

Oh okay, makes sense. Thanks again for the help. :)

Phanx 11-09-11 09:43 PM

Code:

Message: Interface\AddOns\stUnitFrames\layout.lua:12: attempt to concatenate local 'unit' (a nil value)
Code:

if not self or not unit then print("self: "..self..";  unit"..unit) return end
Since you explicitly check whether unit is nil/false before calling print, it seems fairly obvious that you're going to get string concatenation errors. If you want a debug print for nil units, wrap unit in a tostring() call. Also, print does not require manual concatention. You can just pass it multiple values, and it will automatically join them with spaces between. Finally, you will get a (mostly theoretical) speed boost by switching the return/print order.

Code:

if not self or not unit then
    return print("self:", self, "; unit:", tostring(unit))
end

If the unit is nil you will see "self: something ; unit: nil".

Also, depending on how you're using this information, you might want to print self:GetName() instead of just self.


All times are GMT -6. The time now is 12:34 AM.

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