lua-users home
lua-l archive

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

On Mon, 23 Mar 2009 07:09:56 +0200
Asko Kauppi <> wrote:

> I would recommend another (simpler) kind of mechanism:
> - have all of your application state in a separate table (or in the
> _G)
> - store that table when exiting
> - read that table when re-launching, and if it already contains
> stuff, rebuild your application's visual appearance accordingly
> - in regular exit (truly quitting the software) erase the state
> table so the next launch will be "virgin"
it may be good for GUI apps, but it's inappropriate, for example, in
complex rogue-like game. the power of Lua closures allows to write
simple callbacks as anonymous functions, and those will not be
serialized properly. so I must either drop the idea of using anonymous
functions, or write alot of additional code to serialize/deserialize
such things. the both ways are bad, 'cause turn simple things to
overcomplicated ones.

i wonder if Lua 6 can include some built-ins for easy
serialization/deserialization of the interpreter state (with
metamethods for userdatas). as Lua is good suited for game scripting,
it can be much friendlier to game developers (and not only for them
%-). just ask Lua: "serialize yourself with this chunk writing
function" and "deserialize yourself with this chunk reading function".

maybe something like Pluto, but tightly integrated with Lua and with
deep knowledge about internal interpreter structures.