Garry's Mod Wiki

debug.sethook

debug.sethook( thread thread, function hook, string mask, number count )

Description

Sets the given function as a Lua hook. This is completely different to gamemode hooks. The thread argument can be completely omitted and calling this function with no arguments will remove the current hook. This is used by default for infinite loop detection. More information on hooks can be found at http://www.lua.org/pil/23.2.html

Hooks are not always ran when code that has been compiled by LuaJIT's JIT compiler is being executed. This means that relying on them for infinite loop protection is unwise.

Arguments

1 thread thread
Thread to set the hook on. This argument can be omited
2 function hook
Function for the hook to call
3 string mask
The hook's mask
4 number count
How often to call the hook (in instructions). 0 for every instruction

Page Links


Special Pages


Wikis

?

Render Time: 103ms

DB GetPage 55
Generate Html 8
SaveChanges (1) 24
Render Body 0
Render Sidebar 14