SetDebugHook sets the debugging hook function. f is the hook function. mask specifies on which events the hook will be called: it is formed by a bitwise or of the constants MaskCall, MaskReturn, MaskLine, and MaskCount. The count argument is only meaningful when the mask includes MaskCount. For eac
(l *State, f Hook, mask byte, count int)
| 161 | // |
| 162 | // A hook is disabled by setting mask to zero. |
| 163 | func SetDebugHook(l *State, f Hook, mask byte, count int) { |
| 164 | if f == nil || mask == 0 { |
| 165 | f, mask = nil, 0 |
| 166 | } |
| 167 | if ci := l.callInfo; ci.isLua() { |
| 168 | l.oldPC = ci.savedPC |
| 169 | } |
| 170 | l.hooker, l.baseHookCount = f, count |
| 171 | l.resetHookCount() |
| 172 | l.hookMask = mask |
| 173 | l.internalHook = false |
| 174 | } |
| 175 | |
| 176 | // DebugHook returns the current hook function. |
| 177 | func DebugHook(l *State) Hook { return l.hooker } |