Skip to content

Commit 73c7f7b

Browse files
committed
Fix hooks more.
1 parent 468c13a commit 73c7f7b

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

Classes.lua

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6109,16 +6109,27 @@ end
61096109

61106110
do
61116111
local inProgress = {}
6112+
local vars = {}
61126113

6113-
ns.callHook = function( hook, ... )
6114-
if not class.hooks[ hook ] or inProgress[ hook ] then return ... end
6115-
local vars = { ... }
6114+
local function load_args( ... )
6115+
local count = select( "#", ... )
6116+
if count == 0 then return end
61166117

6117-
inProgress[ hook ] = true
6118-
for _, h in ipairs( class.hooks[ hook ] ) do
6119-
vars = { h( unpack( vars ) ) }
6118+
for i = 1, count do
6119+
vars[ i ] = select( i, ... )
61206120
end
6121-
inProgress[ hook ] = nil
6121+
end
6122+
6123+
ns.callHook = function( event, ... )
6124+
if not class.hooks[ event ] or inProgress[ event ] then return ... end
6125+
wipe( vars )
6126+
load_args( ... )
6127+
6128+
inProgress[ event ] = true
6129+
for i, hook in ipairs( class.hooks[ event ] ) do
6130+
load_args( hook( unpack( vars ) ) )
6131+
end
6132+
inProgress[ event ] = nil
61226133

61236134
return unpack( vars )
61246135
end

State.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6909,7 +6909,7 @@ function state.advance( time )
69096909
end
69106910
end ]]
69116911

6912-
ns.callHook( "advance_end", time )
6912+
time = ns.callHook( "advance_end", time ) or time
69136913

69146914
return time
69156915
end

0 commit comments

Comments
 (0)