lua-users home
lua-l archive

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

I am not a Lua expert so I don't know how it handles this.

To modify code inside a debugger or IDE is the easy part. The interesting part is doing it in running production systems. For that you need a very clear definition of what it means to load code and how this affects the system. For example if you reload a function which someone is executing how will it be affected. You need support from the underlying system/implementation to do this. I come from another world, erlang, where this is defined and it is only because it is defined that you can dynamically manage code at runtime.

So something similar would be needed in Lua to do this properly. It depends, of course, whether this is a goal for the language or not.


Philippe, thanks for the reply.
so i am been programming in Basic for over 38 years.
my first computer had a version of basic hand-coded by bill gates, in the 1970's.

yes, it is true that visual basic does require the use of an IDE but visual basic for application does have a interactive console.
yes, i use print() and that works  and only for people who cannot do edit-and-continue are doomed to be punished with just print().
not a very nice solution when i am trying to teach programming concepts to children.

lol, i used to program using punch cards on an ibm mainframe, perhaps we should downgrade back to that, who needs keyboards anyway...

since i first asked my question, and based on some posts and doing some research, edit-and-continue can in fact be done for Lua from the interactive console.

it is much more then a crutch or convenience.
anybody that has not tried it should not trivialize it.
all the more so for Lua.
Lua is designed to be a embedded solution, often used by non-programmers.
for example, arrays indexes start from 1, not zero.

you should take a look at the posts by Kevin T. Ryan.
one example of what he wrote is:
"You may want to try ZeroBrane Studio:

after looking at the videos, let me know what you think. youtube has some great videos.
look at the zues editor for Lua videos
thanks and enjoy.

> To:
> From:
> Date: Fri, 22 Jun 2012 14:44:44 +0200
> Subject: Re: newbie: how to modify lua code while the program is running like visual basic
> On 21/06/2012 21:41, yoyomeltz yoyomeltz wrote:
> > kevin, thanks you much. it does seem to offer what i wanted but the problem is i would be
> > locked into an ide that does not seem to offer much else.
> >
> > there has to be a simple way to dynamically reload code as needed via a
> > console/command.line or other simple solution.
> > if visual basic from microsoft can do it and python can do it, then why should i be an
> > issue for Lua.
> > even visual basic 6.0 from 10 years ago can do that.
> >
> > it seems to me this such a feature is a pre-requisite for learning any language, espcially
> > a lightweight scripting language.
> > so does anybody have any other suggestions?
> Well, if I am not mistaken, VB is "locked into an IDE"...
> I don't know for Python.
> Debugging is often tied to an IDE anyway, unless you are using some command line debug
> tool (but that's still a tool, often separate of the compiler / interpreter, no?).
> Eclipse (and probably other Java IDEs as well) allows such hot fix, changing code while
> running and the program continue to run with this change.
> Now, it has some limitations: if you change a method while debugging in it, Eclipse puts
> the current program line pointer to the start of the method.
> If you change deeply a class, eg. the visibility of a method, or a new method, it tells
> you it can't do the hot fix and shows markers in the debug stack trace to show the code is
> no longer synchronized.
> So it isn't a perfect feature for every language / IDE. Just a very convenient feature!
> Note: don't under-evaluate the power of print() in tracing / debugging Lua! :-)
> --
> Philippe Lhoste
> -- (near) Paris -- France
> --
> -- -- -- -- -- -- -- -- -- -- -- -- -- --