[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Serializing lua state.
- From: "Adam D. Moss" <adam@...>
- Date: Wed, 11 Sep 2002 14:36:58 +0100
Hi!
I was wondering if anyone out there has any experience or
thoughts on serializing and deserializing the state of the
lua environment to/from disk.
What I'd like to do is to be able to record the state of
the active lua data/scripts to disk (save-game files) and
restore them again in a later program invokation.
The way I'm using lua entails that it is not just a set of
functions that get invoked for entity-specific events (otherwise
I could just save/restore a list of which scripts had been
loaded), but also that the state of entities (switches on/off,
tracking of AI goals) is also within the lua environment (the
entirety of the game-specific logic is in lua, in theory, and the
C engine API exists to service the scripts rather than vice-
versa).
Serializing the globals table is not hard, but a lot of state is
potentially also in closures, etc. I also wonder where the current
state of yield()ed coroutines may be accessed.
Am I just entering a world of pain?
I can code/design around this in a few not-quite-desirable ways
but I was wondering if anyone else had any insights.
Thanks a lot!
--Adam
--
Adam D. Moss . ,,^^ adam@gimp.org http://www.foxbox.org/ co:3