Using hook

I have a question about hooks. Say I had a function like this:

function SomeFunction()
  return hook.Call("SomeFunctionHook")  
end

If there is no hook hooked up, will it return null or throw an error. Plus, how would I provide arugments like this:


function SomeFunction()
 local arg1 = 50
 return hook.Call("SomeFunctionHook", arg1)
end

Would I have to provide:

function SomeFunction()
 local arg1 = 50
 return hook.Call("SomeFunctionHook", GAMEMODE, arg1)
end

Basicly, I still don’t understand how the hook system works. Kinda new it.

If a hook has no functions hooked to it or no functions that return anything, hook.Call will return nil. To pass arguments to hook.Call you do this:

[lua]hook.Call(“SomeFunctionHook”, GAMEMODE, arg1, arg2, arg3)[/lua]

If you don’t want to supply a gamemode table, just pass nil.

[lua]hook.Call(“SomeFunctionHook”, nil, arg1, arg2, arg3)[/lua]

Ah, thanks. That answers ALOT of questions. Fast too. :smiley: