Ralgathor / LibClassicSwingTimerAPI

GNU General Public License v3.0
4 stars 5 forks source link

Allow ADDON_LOADED to process when loaded as embedded library #47

Closed Korbrawr closed 1 year ago

Korbrawr commented 1 year ago

Currently, if the addon is loaded as an embedded library, ADDON_LOADED does not fire with the name of LibClassicSwingTimerAPI as the game considers the library to be loaded as part of the parent addon.

This causes problems as self.player and self.target are only initialized in lib:ADDON_LOADED for version 2.0.1, so upon any CLEU events (or addons attempting to access the API), many lua errors are generated.

This PR reads the name of the addon which had loaded LibClassicSwingTimerApi.lua and allows lib:ADDON_LOADED to correctly initialize when another addon embeds the library.

After these changes, the addon works properly as an embedded library.