lua-users home
lua-l archive

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


hi Max,

first of all, thank you for the reply :-)

> Edit and continue is something I've experimented with a bit for
> Decoda. I had pretty good success (at least to a proof of concept
> stage) by rewriting the Lua source code at run-time to allow
> individual lines to be patched. For a basic statement it's something
> like this:

> if (patch_N) then patch_N() else <original code from line N>

> To replace line N, you just create a new function with the code and
> assign it to patch_N. Of course there is some complexity when dealing
> with local variables, upvalues, etc. and constructions like ifs and
> loops, but I think the Lua API provides the necessary hooks and with
> enough effort it can be done. The additional code will also affect the
> run-time performance, but in my experience this isn't really an issue
> for most applications.
you mean, that it is possible to do this using line hooks, i.e.
remember what line user changed in the compiled chunk and then when
the changed line is executing try to execute another (changed) line?
But then how to suppress original line execution?

Or you mean, that you use compiled chunk structure and insert this
logic into it? Is there any description of the compiled chunk internal
structure?

Do Lua authors have ideas about how to implement Edit and Continue?

> We'll probably include something like this in a future version of
> Decoda. Having direct support in Lua for edit and continue would
> certainly be nice, but I assume this is not a simple thing to add into
> the interpreter.
Direct support in Lua would be great, since custom code may be broken
in the next Lua release.


Yours respectfully,

Dmitriy Iassenev, iassenev@gsc-game.kiev.ua
 Phone (mobile): +380958392212
  ICQ: 72752187
   GSC Game World - Ukraine, Kyiv
    http://www.stalker-game.com, http://www.gsc-game.com