mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Make the register functions optionally return a cancel callback.
It's now possible to have complete flexibility with cancelling bindings, i.e. it's possible to re-implement all of the other ways to cancel bindings using the callback. This sytem has been designed with complete safety in mind: - It is safe to call the callback more than once (does nothing after the first call). - The callback does not expire, and can be stored for as long as necessary. - If a callback is returned, there is no other way to cancel the binding (again, due to safety).
This commit is contained in:
@@ -272,7 +272,7 @@ public:
|
||||
bool ShouldReload() const { return reload; }
|
||||
bool IsEnabled() const { return enabled && IsInitialized(); }
|
||||
bool HasLuaState() const { return L != NULL; }
|
||||
void Register(uint8 reg, uint32 id, uint64 guid, uint32 instanceId, uint32 evt, int func, uint32 shots);
|
||||
int Register(lua_State* L, uint8 reg, uint32 id, uint64 guid, uint32 instanceId, uint32 evt, int func, uint32 shots, bool returnCallback);
|
||||
|
||||
// Non-static pushes, to be used in hooks.
|
||||
// These just call the correct static version with the main thread's Lua state.
|
||||
|
||||
Reference in New Issue
Block a user