Quantcast
Event LUA_WARNING payload 0 and NULL - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-02-20, 06:35 PM   #1
AreGee
A Defias Bandit
Join Date: Jun 2020
Posts: 3
Event LUA_WARNING payload 0 and NULL

I did register for the event LUA_WARNING in case it would catch some of the silent errors that I have been getting, and indeed I do receive these events. The problem is that the payload is 0 (null) every single time and I can't for the world understand what is going wrong. I have no problem getting the payload from any of the other events that I am handling.

Here is the function that is receiving and handling the events:

Code:
local function AST_Event_LUAWarning(self, event, ...)
 local warnType, warningText = ...
 print("Warning: LUA_WARNING, type: " .. tostring(warnType) .. ", text: " .. warningText)
end
The function is handled by a generic event handler that I made. It is working for all other events, but I include it in case someone wants to investigate:

Code:
local function AST_EventAlreadyRegistered(newEventName)
 assert(type(newEventName) == "string", "Error: function AST_EventAlredyRegistered(newEventName)\n   - Input type is not a 'string'.")

--[[
 if not (type(newEventName) == "string") then
  print("Error: function AST_EventAlredyRegistered(newEventName)")
  print("   - Input type is not a 'string'.")
  return false
 end
--]] 
 for i, item in ipairs(_V.Events) do
  local existingEventName, func = item["eventName"], item["func"]
  if newEventName == existingEventName then
   return true
  end
 end
 return false
end

local function AST_RegisterEvent(frame, eventName, func)
 if AST_EventAlreadyRegistered(eventName) then
  print("Warning: function AST_RegisterEvent(eventName, func)")
  print("   - Silently dropping double registering of event '" .. eventName .. "'.")
  return
 end
 local item = {frame = frame, eventName = eventName, func = func}
 table.insert(_V.Events, item)
 frame:RegisterEvent(eventName)
end

local function AST_MainEventHandler(self, event, ...)
 local eventWasHandled = false
 
 for i, item in ipairs(_V.Events) do
  if item.eventName == event then
   eventWasHandled = true

   local t = type(item.func)

   if t == "function" then
    item.func(self, event, ...)

   elseif t == "nil" then
    print("Notice: Event '" .. event .. "' was subscribed to, but not assigned any action.")
    return
    
   else
    print("Warning: function AST_RegisterEvent(frame, eventName, func)")
    print("   - Encountered data type for event function other than 'function' or 'nil'.")
    print("     Type: " .. t .. ", Value: " .. tostring(item.func) .. ".")
   end
  end
 end
 
 if not eventWasHandled then
  print("Warning: AST_MainEventHandler(self, event, ...)")
  print(".  - Event '" .. event .. "' was fired, but not handled because it is unrecognised.")
  print("   - If you see this message, you might want to create handlers to deal with those events.")
 end
end
My question is: Why is there no payload/is there anything that I am doing wrong? I can't find anything online regarding this event than type and text should be the payload for this event.

Last edited by AreGee : 06-02-20 at 09:09 PM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Event LUA_WARNING payload 0 and NULL

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off