lua-users home
lua-l archive

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


On Mon, Mar 23, 2009 at 4:01 AM, kathrin_69@gmx.de <kathrin_69@gmx.de> wrote:
> I'm not the most experienced C-programmer, but if I save the lua_State*
> between two calls to lua_Resume(), there shouldn't be any process stack
> memory in use by Lua functions, because all Lua-functions are already
> returned and therefore all stack is un-winded. Am I wrong with this?

Kathrin, this won't work. There will be address inter-dependencies
between the chunks of memory.

> I have not tried it yet, but I fear serialization will be to slow for my
> needs, because I'll have to save the lua_State on every cycle of a
> simulation loop to allow precise/granular rollback.

Saving and restoring complex dynamically allocated C datastructres is
quite difficult, and the approaches that do work, like Pluto?, are
heavy-weight enough that they are very unlikely to be fast enough to
use in an inner loop.

I think you're on the wrong path, why don't you do state snapshot and
rollback in pure lua?

You might get more useful advice from the list if you described what
you want to achieve.

Sam