View Single Post
02-25-15, 08:07 AM   #1
Mercian
A Murloc Raider
Join Date: Apr 2012
Posts: 6
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
				buffInGroup = sb.showAllBuffs
				frameitem.Comparisons["ismine"] = caster == "player";

				if not buffInGroup and sb.showAllNonRaiderBuffs and caster ~= nil then
					casterGUID = UnitGUID(caster);
					if casterGUID ~= nil then 
						BB = tonumber(casterGUID:sub(5,5), 16);
						maskedBB = BB % 8; -- x % 8 has the same effect as x & 0x7 on numbers <= 0xf
						-- mask with 0x7 to get: 0 for players, 1 for world objects, 3 for NPCs, 4 for permanent pets, 5 for vehicles.
						if maskedBB ~= 0 and maskedBB ~= 4 and maskedBB ~= 5 then
							buffInGroup = true
						end
					end	
				end
the line
Code:
maskedBB = BB % 8;
is throwing the error.

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?

Last edited by Mercian : 02-25-15 at 08:23 AM.
  Reply With Quote