[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Desired Lua Features
- From: Sean Conner <sean@...>
- Date: Mon, 29 Jan 2018 02:01:58 -0500
It was thus said that the Great Coda Highland once stated:
> On Sun, Jan 28, 2018 at 3:39 PM, Sean Conner <sean@conman.org> wrote:
> > It was thus said that the Great Paige DePol once stated:
> >>
> >> So, if you could add any one feature to Lua right now, what would that
> >> feature be and why would you want to see it added? Please note that this
> >> discussion is in no way meant to be interpreted as pressuring Team Lua to
> >> add any features to Lua, I am genuinely curious what features people want
> >> to see added to Lua and why.
> >
> > Right now---breakpoints. Every CPU I've programmed has had such a
> > feature. The x86 has INT3, the MC68000 has TRAPn, MIPS the BREAK, the 6502
> > BRK, the 6809 SWI, etc. I would like to see a Lua VM opcode that does the
> > same thing, which could be used to avoid the overhead of hooks (the Lua
> > program can run full speed until the breakpoint is hit).
> >
> > Some API in the debug module would probably have to be made to support
> > this, but it's something I feel would be nice. Even something as simple as
> > tripping on a function call:
> >
> > debug.setbreakpoint(target_function,code_to_run)
> >
> > where code_to_run() can then do the full hooks method if further detail was
> > needed.
> >
> > -spc
>
> I mean, Javascript has the debugger; statement.
>
> If you want to imitate this behavior, all you need to do is write a
> trivial C API function and call it. It checks for a suitable debugger
> hook, calls it if present, and returns. This doesn't require any
> changes to the VM.
I'm not sure what you mean. Yes, Lua can hook into function calls, but
it's *every* function call. What I'm talking about is some flag such that
if function foo() is called, then a hook is called; otherwise the Lua VM
runs at full speed.
-spc