|
10 | 10 | <tutorials> |
11 | 11 | </tutorials> |
12 | 12 | <methods> |
| 13 | + <method name="get_hook" qualifiers="const"> |
| 14 | + <return type="Variant" /> |
| 15 | + <description> |
| 16 | + Returns the current hook function. |
| 17 | + See [method set_hook]. |
| 18 | + </description> |
| 19 | + </method> |
| 20 | + <method name="get_hook_count" qualifiers="const"> |
| 21 | + <return type="int" /> |
| 22 | + <description> |
| 23 | + Returns the current hook count. |
| 24 | + See [method set_hook]. |
| 25 | + </description> |
| 26 | + </method> |
| 27 | + <method name="get_hook_mask" qualifiers="const"> |
| 28 | + <return type="int" enum="LuaThread.HookMask" is_bitfield="true" /> |
| 29 | + <description> |
| 30 | + Returns the current hook mask. |
| 31 | + See [method set_hook]. |
| 32 | + </description> |
| 33 | + </method> |
| 34 | + <method name="get_stack_info" qualifiers="const"> |
| 35 | + <return type="LuaDebug[]" /> |
| 36 | + <description> |
| 37 | + </description> |
| 38 | + </method> |
| 39 | + <method name="get_stack_level_info" qualifiers="const"> |
| 40 | + <return type="LuaDebug" /> |
| 41 | + <param index="0" name="level" type="int" /> |
| 42 | + <description> |
| 43 | + </description> |
| 44 | + </method> |
| 45 | + <method name="get_traceback" qualifiers="const"> |
| 46 | + <return type="String" /> |
| 47 | + <param index="0" name="message" type="String" default="""" /> |
| 48 | + <param index="1" name="level" type="int" default="0" /> |
| 49 | + <description> |
| 50 | + </description> |
| 51 | + </method> |
13 | 52 | <method name="is_main_thread" qualifiers="const"> |
14 | 53 | <return type="bool" /> |
15 | 54 | <description> |
16 | 55 | Whether this thread is the [LuaState]'s main thread. |
17 | 56 | See also [member LuaState.main_thread]. |
18 | 57 | </description> |
19 | 58 | </method> |
| 59 | + <method name="set_hook"> |
| 60 | + <return type="void" /> |
| 61 | + <param index="0" name="hook" type="Variant" /> |
| 62 | + <param index="1" name="mask" type="int" enum="LuaThread.HookMask" is_bitfield="true" /> |
| 63 | + <param index="2" name="count" type="int" default="0" /> |
| 64 | + <description> |
| 65 | + Sets the debugging hook function. |
| 66 | + [param hook] is the Hook function, which should be either a [Callable] or [LuaFunction]. Pass [code]null[/code] to disable hooks. |
| 67 | + [param mask] specifies on which events the hook will be called: it is formed by a bitwise OR of the constants [constant HOOK_MASK_CALL], [constant HOOK_MASK_RETURN], [constant HOOK_MASK_LINE] and [constant HOOK_MASK_COUNT]. Pass 0 to disable hooks. |
| 68 | + [param count] is only meaningful when the mask includes [constant HOOK_MASK_COUNT]. |
| 69 | + See [enum HookEvent] for the available hook events. |
| 70 | + See also [url]https://www.lua.org/manual/5.4/manual.html#lua_sethook[/url]. |
| 71 | + </description> |
| 72 | + </method> |
20 | 73 | </methods> |
21 | 74 | <members> |
22 | 75 | <member name="status" type="int" setter="" getter="get_status" enum="LuaThread.Status"> |
|
45 | 98 | <constant name="STATUS_DEAD" value="-1" enum="Status"> |
46 | 99 | The thread has finished execution. |
47 | 100 | </constant> |
| 101 | + <constant name="HOOK_MASK_CALL" value="1" enum="HookMask" is_bitfield="true"> |
| 102 | + Mask passed to [method set_hook] to subscribe to [constant HOOK_EVENT_CALL] and [constant HOOK_EVENT_TAIL_CALL] hooks. |
| 103 | + </constant> |
| 104 | + <constant name="HOOK_MASK_RETURN" value="2" enum="HookMask" is_bitfield="true"> |
| 105 | + Mask passed to [method set_hook] to subscribe to [constant HOOK_EVENT_RETURN] hooks. |
| 106 | + </constant> |
| 107 | + <constant name="HOOK_MASK_LINE" value="4" enum="HookMask" is_bitfield="true"> |
| 108 | + Mask passed to [method set_hook] to subscribe to [constant HOOK_EVENT_LINE] hooks. |
| 109 | + </constant> |
| 110 | + <constant name="HOOK_MASK_COUNT" value="8" enum="HookMask" is_bitfield="true"> |
| 111 | + Mask passed to [method set_hook] to subscribe to [constant HOOK_EVENT_COUNT] hooks. |
| 112 | + </constant> |
| 113 | + <constant name="HOOK_EVENT_CALL" value="0" enum="HookEvent"> |
| 114 | + Hook event that is called when the interpreter calls a function. The hook is called just after Lua enters the new function. |
| 115 | + </constant> |
| 116 | + <constant name="HOOK_EVENT_RETURN" value="1" enum="HookEvent"> |
| 117 | + Hook event that is called when the interpreter returns from a function. The hook is called just before Lua leaves the function. |
| 118 | + </constant> |
| 119 | + <constant name="HOOK_EVENT_LINE" value="2" enum="HookEvent"> |
| 120 | + Hook event that 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. |
| 121 | + </constant> |
| 122 | + <constant name="HOOK_EVENT_COUNT" value="3" enum="HookEvent"> |
| 123 | + Hook event that is called after the interpreter executes every [code]count[/code] instructions. This event only happens while Lua is executing a Lua function. |
| 124 | + </constant> |
| 125 | + <constant name="HOOK_EVENT_TAIL_CALL" value="4" enum="HookEvent"> |
| 126 | + Hook event that is called when the interpreter calls a function as a tail call. In this case, there will be no corresponding return event. |
| 127 | + </constant> |
| 128 | + <constant name="HOOK_OK" value="0" enum="HookResult"> |
| 129 | + </constant> |
| 130 | + <constant name="HOOK_YIELD" value="-1" enum="HookResult"> |
| 131 | + Return this value from line or count hook events to yield execution of the current Lua function that triggered the hook. |
| 132 | + </constant> |
48 | 133 | </constants> |
49 | 134 | </class> |
0 commit comments