Rework module export for addons
Closed this issue · 0 comments
HybridEidolon commented
To leverage Lua's require
module loading and avoid creating issues with code executing when addons are required by other addons, the flow for registering addons needs to be changed:
- Addons should be required to export a table that contains all the hook registration functions it wants to use.
- The
pso.on_*
functions should be removed.
On the addon loading phase when initializing the Lua context, the registration code will take the functions from that table and bind them itself.
For multiple registrations on a single event for a single addon, it would instead have to manage its own list of callbacks and run through them in its handler.