View Single Post
01/03/17, 08:20 PM   #1
Bobby Blue
Join Date: Dec 2016
Posts: 5
Overriding default functions

Hi all,

I'm just trying to write a simple addon that inserts timestamps at the start of every chat message (I know, that's been done before, but I'm just trying to learn, so I thought I'd start with something small).

At this point, I'm trying to override SharedChatContainer:OnChatEvent:
Lua Code:
  1. function SharedChatContainer:OnChatEvent(event, formattedEvent, category)
  2.     formattedEvent = GetTimestamp() .. formattedEvent           -- My code
  3.     for i=1, #self.windows do
  4.         if IsChatContainerTabCategoryEnabled(self.id, i, category) then
  5.             self:AddEventMessageToWindow(self.windows[i], formattedEvent, category)
  6.         end
  7.     end
  8. end

But that doesn't seem to work for some reason. The error I am getting is 'expecting function instead of nil', so I've already understood that the function is unable to access the Timestamps table. Why? Is there some way to work around this?

And yes, I do want to call the GetTimestamp() function, because I am formatting the result of ZO_FormatClockTime() before using it.

Thanks for your help and happy new year

Last edited by Bobby Blue : 01/03/17 at 09:22 PM.
  Reply With Quote