Debuff Filter - need help in solve lua error
Hi guys,
first I want to say: I'm totally new to LUA. I'm working with other scripting languages. Getting this one LUA error is a pain in the ass for me and as the original author is not playing anymore I try to figure out the issue by myself. Following the error it throws: Error occured in: Global Count: 1 Message: ..\AddOns\DebuffFilter\DebuffFilter.lua line 2279: attempt to perform arithmetic on local 'BB' (a nil value) Debug: DebuffFilter\DebuffFilter.lua:2279: DebuffFilter_Frame_Update() DebuffFilter\DebuffFilter.lua:1799: DebuffFilter\DebuffFilter.lua:1796 When looking into the code the issue is caused by these lines of code: Code:
while texture do Code:
maskedBB = BB % 8; According to the local stack from the error the variables have the following values: BB = nil maskedBB = nil caster = "target" EDIT: Additionally the variable: casterGUID = "Creature-0-1467-1153-21838-79821-0000562487" My first question is, what does this line mean: frameitem.Comparisons["ismine"] = caster == "player"; I've not found any information in using "=" and "==" in this way. Thanks a lot for any help ;) EDIT 2: Found out the reason: casterGUID:sub(5,5) of casterGUID = "Creature-0-1467-1153-21838-79821-0000562487" cannot be converted to a number. So why is this GUID not matching the description of http://www.wowwiki.com/API_UnitGUID? |
just a quick reply:
1. it's Lua, not LUA ;) 2. "a = b == c" is the same as "a = (b == c)", so a = true if b equals c 3. regarding your error: It's caused by this statement: BB = tonumber(casterGUID:sub(5,5), 16); What it does is trying to convert the 5th char in the string to a number by interpreting it as a hexadecimal value. Since your string starts with "creature", the 5th char is a t which has no hexadecimal meaning. Why does this happen? Well, GUID changed for WoW 6.x (see: http://wow.gamepedia.com/GUID, old: http://wow.gamepedia.com/index.php?t...&oldid=2939882 ). Fix: adapt the code to the new GUID format (e.g. get the first part and match it against the desired values) |
oh sorry...will remember to name it "lua" :)
regarding you links: perfect, this is explaining the error. New question: Regarding your links the result of UnitGUID() is different between player and creatures. So instead of doing the masking I need to do a substring of the first part (start till first occurance of "-") to identify the unittype, right? So synthax would be like if casterGUID ~= nil then BB =casterGUID:sub(5,casterGUID:find("-")) if BB == "Creature" buffInGroup = true end end Is the type "Creature" also including Rare mobs? Because I saw an extra type "vignette" in your link. |
Never did much work with GUIDs myself, so I don't know which is used for what, sorry.
But regarding getting the first part of the string, your syntax for :sub is wrong (e.g. starts at 5th char and includes the dash). You could try one of the following: Code:
bb = strsplit("-", casterGUID) -- split string on dashes, assign the first resulting string to BB, discard rest |
Quote:
thanks for your suggestion. But as UnitType can also be "Pet" it would not be the longest sequence of non-dash characters. I will check if my idea is working ;) |
btw...my solution is working. Thanks for the help.
|
Does it really work or just not error? There's s slight difference between the two ;)
also, if the unit type is "Pet", the GUID will be "Pet-0-...", so it's still the longest sequence of non-dash characters starting at the beginning of the string. :p |
Quote:
|
Quote:
My solution is working. I had issues on my warlock, that a buff was not updated correctly. I tested yesterday with several chars, checking buffs and debuffs of player and creatures. Additionally in first try I forgot the "then" after an if condition...the frames were not displayed at all (without showing an lua error). After correcting this the frames were displayed correctly and no lua error was displayed. Is there a way to do some kind of debugging? To know the result of my code? Quote:
|
Quote:
https://github.com/Phanx/ShieldsUp/b.../Core.lua#L174 As it proceeds through the logic, at key points it prints out what it's doing and/or the values of certain variables. These messages appear in the chat frame so you can see exactly what's going on. Just don't forget to comment out or remove these debugging messages when you're done, though, especially if you plan to publish your addon. You can see in my code that many of the messages are already commented out, but some are still "live" since the addon is currently being rewritten and tested. |
Thanks a lot, will proof my solution with this.
As this is not my addon I suggested the solution to the author and will keep the changes only on my local copy. I was so frustrated due to the errors and not working display that I tried to find the issue by myself. As I said the original author is not playing anymore. He has given author rights to another user who requested them, but last information was, that he/she has also no experience using lua so it might take a while to solve the issue. So I did it myself and posted the solution. Thanks so far for all the help :) |
All times are GMT -6. The time now is 03:39 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI