View Single Post
07/24/22, 10:27 PM   #13
hilarityensues
AddOn Author - Click to view addons
Join Date: Jul 2022
Posts: 7
Originally Posted by Sharlikran View Post
Just a quick note, checking for duplicates you use the id64 event I'd in the form of a string as mentioned and loop over the events. If looping over the events more then once takes time then organize your data differently. Such as using the id64, in the form of a string as the key.

Even if SetNextEventCallback() says it is in order Lua does not save anything in order. Meaning if I have an array starting with [1] and then I add [2] the next time the game loads it could read it as 2, 1.
Yes, two things I'm trying to avoid 1) O(n) when assessing duplicates and 2) having to store a variable for the last key (eventId, timestamp, key, whatever).

So the idea is, if we have the array store in the order in which the events are passed using `SetNextEventCallback()`, that means I can take care of both by identifying the last rec'd eventId:
Lua Code:
  1. dataTable[#dataTable][eventId]
At least that's the idea. The existence of SetMissedEventCallback() makes me nervous.
  Reply With Quote