WoWInterface (
-   Lua/XML Help (
-   -   BNGetGameAccountInfo() returning nil (

galvin 05-16-19 10:02 PM

BNGetGameAccountInfo() returning nil
This is a weakaura which has been working fine till recently.
So did a test had a friend whisper me thru bnet.
The IDAccount comes back 132.
BNGetFriendInfoByID(132) returns nil
rest blows up

So do I need change something or did blizzard break something?


function(Event, ...)
    local Msg = nil
    local Sender = nil
    if Event == "CHAT_MSG_WHISPER" then
        Msg = select(1, ...)
        Sender = Ambiguate(select(2, ...), 'none')
    elseif Event == "CHAT_MSG_BN_WHISPER" then
        Msg = select(1, ...)
        local IDAccount = select(13, ...)
        local IDGameAccount = select(6, BNGetFriendInfoByID(IDAccount))
        local _, ToonName, Client, RealmName = BNGetGameAccountInfo(IDGameAccount)
        if Client == 'WoW' and RealmName == GetRealmName() then
            Sender = ToonName
    if Sender then
        local Index = 0
        local Found = false
        local Player = nil
        local MaxMembers = GetNumGroupMembers()
        while Index < MaxMembers do
            Index = Index + 1
            Player = GetRaidRosterInfo(Index)
            if  Player and Player ~= '' and Player == Sender then
                Found = true
                aura_env.MessageText = format('%s\n%s', Sender, Msg)
        return Found
        return false

SDPhantom 05-17-19 01:05 AM


Originally Posted by galvin (Post 332121)

function(Event, ...)

The frame always sends itself as the first argument, followed by the event and the rest of the parameters. Everything else looks fine.

PS: You shouldn't run select(1,...) ever. You're telling it to return the list of arguments as-is starting from position 1 (the beginning). This accomplishes nothing and wastes CPU on a global lookup and a function call. The following code does exactly the same without any of the overhead.

Msg = ...

galvin 05-18-19 03:06 PM

So the error is happening cause of something blizzard is doing then?

SDPhantom 05-19-19 05:56 AM

From what's posted, you have a missing arg in your function parameter list. Without it, the entire list is shifted over by one.

For example, it should be function(self, event, ...) not function(event, ...).

Vlad 05-20-19 05:24 AM


Originally Posted by galvin (Post 332140)
So the error is happening cause of something blizzard is doing then?

The manner in which you pass the function you use to process the events affects what arguments you get passed during runtime.

widget:SetScript("OnEvent, function(self, event, ...) end) the self would (in most cases) be same as widget, followed by the event that called the function, and a list of potential arguments.

In your code you mislabel it like widget:SetScript("OnEvent, function(event, ...) end) thus you now use event thinking it's the event name, but it's actually the widget reference, and the arguments following when unpacked like local arg1, arg2 = ... now actually set arg1 to be the event, then arg2 would be the first argument of that event.

galvin 05-20-19 10:40 PM

Well if I change Event, to a different parm, then its not going to be the actual event every time.
So not sure how I can fix. Its up to weakauras how it calls the function

galvin 05-31-19 02:28 PM

This code is working fine now
Thanks for the help

All times are GMT -6. The time now is 12:14 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI