lua-users home
lua-l archive

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


On Tue, May 23, 2000 at 09:37:59PM -0300, Steve Dekorte wrote:
> 
> Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> > >From: Stephen Dekorte <steve@egroups.net>
> > >
> > >Is anyone considering adding a way to modify the (lua) stack 
> > >from within Lua?
> > 
> > Why would you want to do this?
> 
> There's a bunch of potential uses: implementing exceptions and threads 
> from within Lua. The ability of storing the stack state at a moment in time 
> and then starting it up later would also be usefull for some applications. 
> Wouldn't it be nice to be able to send a lua program across a network 
> while it was in the middle of executing?

Agreed. Exceptions would be exceptionally nice. :) Stack-swapping
based cooperative multitasking would also be nice (although I think
this is doable now if done from outside Lua, I seem to remember
someone doing it).

> This assumes your only using lua to call into C and come right back out
> without calls back into lua - since that involve the C stack. This is
> the case for my application.

That depends. I assume it's implemented as a unified C/lua stack, in
which case we could walk the stack and modify/unroll both lua and C
regions. Exceptions would still work in and out of C in this case. I
believe they do this in the python runtime.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net