lua-users home
lua-l archive

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


Hi,

I'm trying to serialize(persist) and deserialize(unpersist) a lua state
using the Pluto lib. It seems to work fine (got good help from the author).

But now I face a difficult task. I have to start(resume) the same place
where I left(yielded) the original script I serialized.
The script contains many yields and resumes, and I want to start the script
again as if it wasn't persisted/unpersisted but it just resumed.

I don't know how difficult this will be but I hope you can help with
comments on my plan.

I have one lua_state with one script running at a time, no corutines for
now. Before I serialize I think I'll run throug the callstack and save all
the names and data of the functions.
Then when I unserialize I'll go throug that list and then rebuild the
CallInfo list with the new Instruction pointers?

Does that sound way out? Or does someone got any better ideas for doing
this?

My main goal is to use the script for savegames and I need to resume the
scripts as if nothing happened.

Regards, Dino