Skip to content

Commit

Permalink
Add check to registerCallback
Browse files Browse the repository at this point in the history
Fixes #2819
  • Loading branch information
Vurv78 committed Nov 9, 2023
1 parent 2d9dcb8 commit c7272e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lua/entities/gmod_wire_expression2/core/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ function wire_expression2_CallHook(hookname, ...)
end

function E2Lib.registerCallback(event, callback)
assert(isfunction(callback), "registerCallback must be given a proper callback function!")

if not wire_expression_callbacks[event] then wire_expression_callbacks[event] = {} end
local currExt = E2Lib.currentextension
table.insert(wire_expression_callbacks[event], function(a, b, c, d, e, f) E2Lib.currentextension = currExt return callback(a, b, c, d, e, f) end)
Expand Down

0 comments on commit c7272e8

Please sign in to comment.