Tao.Lua SDK Documentation

Lua.lua_sethook Method 

Sets the debugging hook function.

[Visual Basic]
Public Shared Function lua_sethook( _
   ByVal L As IntPtr, _
   ByVal func As lua_Hook, _
   ByVal mask As Integer, _
   ByVal count As Integer _
) As Integer
[C#]
public static int lua_sethook(
   IntPtr L,
   lua_Hook func,
   int mask,
   int count
);

Parameters

L
func
func is the hook function.
mask
mask specifies on which events the hook will be called: it is formed by a bitwise or of the constants LUA_MASKCALL, LUA_MASKRET, LUA_MASKLINE, and LUA_MASKCOUNT.
count
The count argument is only meaningful when the mask includes LUA_MASKCOUNT.

Return Value

Remarks

For each event, the hook is called as explained below: * The call hook: is called when the interpreter calls a function. The hook is called just after Lua enters the new function, before the function gets its arguments. * The return hook: is called when the interpreter returns from a function. The hook is called just before Lua leaves the function. You have no access to the values to be returned by the function. * The line hook: is called when the interpreter is about to start the execution of a new line of code, or when it jumps back in the code (even to the same line). (This event only happens while Lua is executing a Lua function.) * The count hook: is called after the interpreter executes every count instructions. (This event only happens while Lua is executing a Lua function.) A hook is disabled by setting mask to zero.

See Also

Lua Class | Tao.Lua Namespace