lua-users home
lua-l archive

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


Andre de Leiradella wrote:
> 
> Is it possible to freeze the execution of a lua program, save its state
> and, some time later, restore the saved state and resume execution from
> where it stopped?

Well I have done something like this in uCore. In my Debugger I freeze
(Going into a special Windows message loop waiting for semaphores!) one
state (in the linehook or callhook functions) and then the debugger is
running in another state controlling the debugged state. 
 
> My idea is to provide a programming environment that makes it easier to
> write cgis, freeing the programmer from having to write dozens of
> separate programs to implement one system. Instead, the program could
> be written all in once, providing the user with data (html) just before
> calling the freeze function, and resuming execution after the user
> presses the send button, making the program continue just after the
> freeze as it nothing had happened, and providing some way to access the
> form's parameters.
> 
> Of course it will require cookies to store information about the
> particular state the user is bound to, but it's no big deal, since
> apache has a module that implements this functionality.

I think it would be better to use a single LUA_T_ARRAY object to hold
all the data for a "cookie session" and then do some XML load/save 'ing
of that object when ever the cookie is requested, I think would make it
more usable!

/Erik