Originally Posted by Crabby654
Alrighty I fixed that issue!
There is something else that has me a bit concerned. Now I pulled this bit of code from another addon to display the old way the friend number would fade out. However there appears to be an erroneous ( in 2 places. I would really appreciate it if anyone could tell me if this makes sense since one of the ) is after an "end".
Code:
handlerhook = ZO_ChatSystem_GetEventHandlers()[EVENT_CHAT_MESSAGE_CHANNEL]
ZO_ChatSystem_AddEventHandler(EVENT_CHAT_MESSAGE_CHANNEL, function(...)
if esettings.timestampchat then
return '|c707070[' .. GetTimeString() .. ']|r ' .. handlerhook(...)
else
return handlerhook(...)
end
end)
The 2 spots I am looking at is the second line: ZO_ChatSystem_AddEventHandler (EVENT_CHAT_MESSAGE_CHANNEL, function(...)
and the 8th (final) line: end )
|
I don't see any problems. The end) is matched up with ZO_ChatSystem_AddEventHandler(
ZO_ChatSystem_AddEventHandler is a function, and it's given two parameters here. One is the event. (Likely a number constant) The second one is a function. You're probably more used to making a function in this format: local function doSomething(...) end. However, that's really just Lua syntax sugar for local doSomething = function(...) end. In Lua, functions don't need to have names, and function(...) is a perfectly valid thing to pass to another function. Here's a functionally equivalent version of code:
Code:
local nonAnonymousFunction = function(...)
if esettings.timestampchat then
return '|c707070[' .. GetTimeString() .. ']|r ' .. handlerhook(...)
else
return handlerhook(...)
end
end handlerhook = ZO_ChatSystem_GetEventHandlers()[EVENT_CHAT_MESSAGE_CHANNEL]
ZO_ChatSystem_AddEventHandler(EVENT_CHAT_MESSAGE_CHANNEL, nonAnonymousFunction)
Hopefully this clears it up a bit, but if not let me know.