Pregunta

I don't have a lot of coding experience, did some C a few years ago, so that helps, but Lua handles things a bit differently, so I can't keep track.

I sometimes (not always) get this error when a friend or guildy logs into the game:

Date: 2013-06-14 16:57:57
ID: -1
Error occured in: Global
Count: 4
Message: ..\AddOns\Tukui\scripts\chat.lua line 335:
        attempt to concatenate upvalue 'classColor' (a nil value)
Debug:
  [C]: ?
   Tukui\scripts\chat.lua:335: AddMessage()
   ..\FrameXML\ChatFrame.lua:2755: ChatFrame_MessageEventHandler()
   ..\FrameXML\ChatFrame.lua:2491: ChatFrame_OnEvent()
   ...s\WIM\Libs\LibChatHandler-1.0\LibChatHandler-1.0.lua:281:
   ...s\WIM\Libs\LibChatHandler-1.0\LibChatHandler-1.0.lua:252
   ...s\WIM\Libs\LibChatHandler-1.0\LibChatHandler-1.0.lua:308:
   ...s\WIM\Libs\LibChatHandler-1.0\LibChatHandler-1.0.lua:296

I have to do a reload of the ui after this happens to be able to see chat text again for that person.

Line 335 in that .lua file is this:

text = replace(text, "^|Hplayer:(.+)|h%[(.+)%]|h", "|Hplayer:%1|h|cff"..classColor.."%2|r|h")

Now I've learned that the .. indicates the concatenate function, but that isn't really helping me.

I don't know if this is enough information, but if you need it I can post the whole local function or whatever else is required.

If it makes any difference, I'm running the 3.3.5a WoW client.

No hay solución correcta

Otros consejos

You are probably using a global that gets defined from some other addon in a now deterministic way While the (classColor or "") will get you rid of the error, you should try and find why that variable (classColor) is sometimes defined and sometimes not. Maybe it happens only for certain classes?

A simple hack would be to just replace

..classColor..

with

..(classColor or "")..

where it will select a blank string when classColor has no value assigned to it.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top