lua-users home
lua-l archive

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


----- Original Message -----
From: "Olaf Razzoli" <olafr@tin.it>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Monday, June 19, 2000 4:41 PM
Subject: Save the Lua state


> Hello
>
> I'm using Lua in a video game to define scenes behaviour.
> When the user save the game to play later, I need to save the Lua state on
a
> file.
> However, the Lua state struct contain a lot of sub-structs dinamically
> allocated.
> There is some way to get this?
>
> Thank you very much for any reply!
>
> Olaf Razzoli
> GMM Entertainment

There are two issues ... Global Data and the more dynamic data (PC - Stack
etc..) If you can do with the global data one of the best way (I'm doing
this also) is having a export/import function to/from XML (XML is a good
format for storing the tables).... I think lhf posted a Lua source for a XML
module some time ago - look in the archive - Mine is programmed in c and
works with a special database.. If you want to store the exact lua_State you
are in for a major task .. Almost all information in Lua is alloc'ed
dynamicly so would would have to travel all structs and build a map... Huge
task :-)

/Erik