Lua попытка индексировать нулевое значение - PullRequest
0 голосов
/ 10 февраля 2020

Я пытаюсь исправить ошибку lua с помощью PlateBuffs World of Warcraft 3.3.5 AddOn. Эта ошибка появляется Lich King kill (прямо перед кинематографом). Я говорю об этом конкретном дополнении: https://www.wowace.com/projects/platebuffs/files/447971

Я не настолько опытен в LUA, но я понимаю, что GetMouseFocus():GetName() - это проблема, потому что GetName() возвращает ноль. Есть ли способ, которым эта ошибка может быть исправлена ​​/ не вызвана?

Или на самом деле это может быть local GetMouseFocus = GetMouseFocus.

Message: ...lateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:819: attempt to index a nil value
Time: 02/10/20 01:40:24
Count: 334
Stack: ...lateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:819: in function <...lateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:817>

Locals: frame = <unnamed> {
 lastUpdate = 0
 0 = <userdata>
 lastHPCheck = 0
}
event = "UPDATE_MOUSEOVER_UNIT"
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index a nil value"
GetMouseFocus = <function> defined =[C]:-1
pairs = <function> defined =[C]:-1
lib = <table> {
 GetLevel = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1123
 GetReaction = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1152
 GetHealthMax = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1230
 onUpdateHooks = <table> {
 }
 GetHealth = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1241
 debugPrint = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:72
 IsTarget = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1225
 checkTarget = <unnamed> {
 }
 onHideHooks = <table> {
 }
 fakePlate = <table> {
 }
 threatStatus = <table> {
 }
 isOnScreen = <table> {
 }
 OnNameplateUpdate = <function> defined OnUpdateString:0
 healthOnValueChanged = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:671
 GetVisibleFrame = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1143
 ModifyOnUpdate = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1435
 callbacks = <table> {
 }
 raidicon_region = <table> {
 }
 isOnUpdating = <table> {
 }
 GetEliteRegion = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:285
 healthOnValueChangedHooks = <table> {
 }
 GUIDs = <table> {
 }
 nameplates = <table> {
 }
 frame = <unnamed> {
 }
 OnNameplateShow = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:549
 IsElite = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1200
 GetTargetNameplate = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1318
 IsBoss = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1176
 GetThreatSituation = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1214
 prevHealth = <table> {
 }
 SetupNameplate = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:769
 GetNameplateByHealth = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1392
 GetThreatRegion = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:297
 IsMarked = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1300
 level_region = <table> {
 }
 elite_region = <table> {
 }
 callbacksRegistered = <table> {
 }
 RegisterCallback = <function> defined @Interface\AddOns\BigWigs\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:118
 GetNameplateByUnit = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1355
 UnregisterCallback = <function> defined @Interface\AddOns\BigWigs\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:181
 noColorNum = <table> {
 }
 GetAllNameplates = <function> defined @Interface\AddOns\PlateBuffs\libs\LibNameplate-1.0\LibNameplate-1.0.lua:1384
 noColorName = <table> {
 }
 NewNameplateCheckHP = <function

LibNameplate-1.0. lua

local function MainOnEvent(frame, event, ...)
    if event == "UPDATE_MOUSEOVER_UNIT" then
        if GetMouseFocus():GetName() == "WorldFrame" then // 819 line
            local i = 0
            local mouseoverPlate
            for frame in pairs(lib.nameplates) do 
                if frame:IsShown() and lib:IsMouseover(frame) then
                    i = i + 1
                    mouseoverPlate = frame

                end
            end
            if i == 1 then
                if not lib.plateGUIDs[mouseoverPlate] then
                    GetMouseoverGUID(mouseoverPlate)
                end
                lib.callbacks:Fire("LibNameplate_MouseoverNameplate", lib.fakePlate[mouseoverPlate] or mouseoverPlate)
            elseif i > 1 then
                debugPrint(i.." mouseover frames")
            end

        end
...