lua-users home
lua-l archive

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


>Since Lua is used in a lot of games and hence represents a large part
>of the community, and since most games need to save states somehow and
>restore it later, has it ever been considered to build this ability
>into Lua itself either offically or as a Lua "port" project?

Try lper. See
	http://lua-users.org/lists/lua-l/2004-05/msg00060.html

I've cleaned up the code and put it my official download area:
	http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/

The author of LPSM tells me that it should run in other Unix platforms.
I've only tested it in Linux.

I've done a little testing and it seems works ok. It certainly works
much better than the previous version, which used mmalloc from gdb.

On the other hand, you have to be careful with storing C pointers inside Lua.
If these pointers point to memory allocated without using LPSM, then you'll
probably have problems when reloading saved Lua states. The solution is to
use LPSM's allocator when you can and to free the pointers and clear their
references in Lua when you can't (eg, for stdio files).

All this will depend on your application, of course. If it's a pure Lua
application that calls C functions but never depend on C pointers, then
I think it will work great.

Enjoy.
--lhf