enable/disable breakpoints from line number #212
-
My goal is to enable/disable breakpoints from the text editor setting them after lua_load() and keeping them aligned when the script is running. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
lua_breakpoint is called on a function object and automatically propagates breakpoints to child functions. As such, the best way for the debugger to use it is to keep the function object that is generated by After that, do something like
Note that if you support unloading scripts, you'd want to release the reference by calling lua_unref when you're done with the script, otherwise the function object will permanently stay in memory until the owning state is closed. |
Beta Was this translation helpful? Give feedback.
lua_breakpoint is called on a function object and automatically propagates breakpoints to child functions. As such, the best way for the debugger to use it is to keep the function object that is generated by
luau_load
by usinglua_ref(L, -1)
after successfulluau_load
- this returns a registry index that can be used to query it later.After that, do something like
Note that if you support unloading scripts, you'd want to release the reference by calling lua_unref when you're done with the script, otherwise the function object will permanently stay in memory until the owning state is closed.