Currently priority is based on registration order and this makes registration order very important, additionally priority of external registrations cannot be easily changed without directly manipulating callback tables.
Add optional priority parameter for event handler registration.
Default should be "normal" priority and it should explicitly allow defining both lower than normal and higher than normal.
Basically just insert handlers to callback table based on priority while registering handlers.
Currently priority is based on registration order and this makes registration order very important, additionally priority of external registrations cannot be easily changed without directly manipulating callback tables.
Add optional priority parameter for event handler registration. Default should be "normal" priority and it should explicitly allow defining both lower than normal and higher than normal. Basically just insert handlers to callback table based on priority while registering handlers.
Kind of like what was done for alias testing but just make it complete by actually tracking priorities to also allow "least important" priority: https://github.com/mt-mods/beerchat/blob/94cb2c449c0dfb1d7b981e564360ce3c0aedce5b/hooks.lua#L25-L42