lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>> Break-on-error in the debugger can easily be achieved (without any change to Lua) if you control the launch of Lua code in the system using `lua_pcall`.
>> The basic idea in this case  is to provide an error function to `lua_pcall` that directly calls the Lua hook in case of error. Here is a simplified version of the one I use in the CodeFlow IDE:
> Thank you for this suggestion. Is this a reliable approach - i.e. can
> a user supply their own error routine in pcall and thereby change the
> behaviour?

It depends at which level your users write their code:
- from Lua code, users can not set  a pcall error function, so the approach can be considered reliable; 
- if yours users have access to the Lua C API, since you have the control of your own VM, you can call the Lua hook just before calling the user-provided error handler.

> I am thinking of a different approach - I am looking at whether I can
> modify the line hook to provide the stack level by maintaining stack
> level information in the CallInfo structure. Please see my reply to
> Paul. Will this approach work?

Actually,  adding a stack level field was to the CallInfo structure looks like a good way of solving the step-over step-out issue.