[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Best way to save/re-load an lua state
- From: Sam Roberts <vieuxtech@...>
- Date: Mon, 23 Mar 2009 11:12:41 -0700
On Mon, Mar 23, 2009 at 4:01 AM, firstname.lastname@example.org <email@example.com> 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.