ESOUI - View Single Post - Let's get rid of LibStub!
View Single Post
05/01/19, 05:34 AM   #17
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,455
@Drakanwulf That looks pretty good. I use the following snippet for my own "new-style" libs:

Lua Code:
  1. local LIB_IDENTIFIER = "LibDebugLogger"
  3. assert(not _G[LIB_IDENTIFIER], LIB_IDENTIFIER .. " is already loaded")
  5. local lib = {}
  6. _G[LIB_IDENTIFIER] = lib

You can probably drop the second assert, since that should never ever be possible to happen, and if it does happen, you have other problems.

@Kyoma the assert is mostly in case other developers decide to start making a new addon with that name, so they get a warning right away.
https://www.imperialtradingcompany.eu/ - My Addons - The Vault (Early updates and experimental projects) - My patreon - My blog
>siri.exe MyAddon
Does your addon work? [y/n] n
There is a typo in there.
  Reply With Quote