ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   event code not returned (https://www.esoui.com/forums/showthread.php?t=9340)

ExoY 08/14/20 03:54 PM

event code not returned
 
Hello,

i think i found a bug with an event not returning its "eventCode", as it should according to: https://wiki.esoui.com/API.
If I am mistaken, feel free to just close or delete this thread.

Its about the Event: EVENT_GROUP_MEMBER_JOINT

Here my code:
Lua Code:
  1. function foo:DebugGroupJoinedEvent(event, name, displayName, isPlayerLocal)
  2.   d("DebugGroupJoinedEvent")
  3.   d("event: " .. event)
  4.   d("name: " .. name)
  5.   d(displayName)
  6.   d(isPlayerLocal)
  7.   d("-------------------------")
  8. end
  9.  
  10. EVENT_MANAGER:RegisterForEvent(self.name.."DebugGroupJoined", EVENT_GROUP_MEMBER_JOINED, self.DebugGroupJoinedEvent)

And here the debug result in chat:

Code:

DebugGroupJointEvent
event: Exoy^Mx
name: @Exoy94
true
nil
-------------------------

As you can see, the eventCode is missing. (I would have included screenshot, if i know how to do that :)

Knurps 08/14/20 04:07 PM

Code:

function foo:DebugGroupJoinedEvent(event, name, displayName, isPlayerLocal)
is short for
Code:

function foo.DebugGroupJoinedEvent(self, event, name, displayName, isPlayerLocal)
so now the event code will be stored in the variable self,
the name will be stored in the variable event,
the display name will be stored in the variable name etc.
That's also why your debug output prints "event: Exoy^Mx".

you want to use
Code:

function foo.DebugGroupJoinedEvent(event, name, displayName, isPlayerLocal)

ExoY 08/14/20 04:15 PM

Thanks for the quick reply.
And what an embarrassing mistake on my side.

Just started to use objects in that form and completely forgot about it.


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

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI