lua-users home
lua-l archive

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

> Suppose I want to save (a part of) the lua state, in binary form. For
> example, lets assume I have _G.state = {...}, and I want to save _G.state,
> to load it somewhere later.
> I scanned luac.c and found that it saves the lua_State in binary form using
> the luaU_dump and clvalue() functions. 

luac does not save the lua_State: it saves functions.

There are many appraoches to saving a Lua table. Search the wiki, e.g.: (Recursive table print/serialization)

These save a table as Lua code in text form, which will probably work fine
for you.  For an experimental approach that uses luac's binary format, see