- Joined
- Sep 26, 2009
- Messages
- 9,534
Damage Engine, Unit Indexer, Unit Event, Is Unit Moving all rely on variable events. The most obvious solution is for me to externalize this hook to avoid running into conflicts.
The below code has been updated to reflect the work of @Forsakn below. If you want to give credit, please scroll down and click "Like" on his post.
The below code has been updated to reflect the work of @Forsakn below. If you want to give credit, please scroll down and click "Like" on his post.
Lua:
-- TriggerRegisterVariableEvent hook to convert these old school events into something more useful.
do
local events = {}
local eventCount = 0
function onRegisterVar(func)
eventCount = eventCount + 1
events[eventCount] = func
end
local oldEvent = TriggerRegisterVariableEvent
function TriggerRegisterVariableEvent(trig, var, op, val)
for i = 1, eventCount do
if events[i](trig, var, val) then return end
end
oldEvent(trig, var, op, val)
end
end
Last edited: