lua-users home
lua-l archive

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



On Oct 22, 2007, at 14:39, Markus Heukelom wrote:

Sorry, I didn't mean the saving the lua_State, but just Lua value(s).

Serialization should be enough in that case, e.g. using Data.lua [1] as an example :

local Data = require( 'Data' )
local aState = { x = 1, y = 2; { 3, 4, 5 } }

Data[ 'state.txt' ] = aState

-- the file 'state.txt' now holds
-- _[1]={}
-- _[1][1]=3
-- _[1][2]=4
-- _[1][3]=5
-- _["y"]=2
-- _["x"]=1

-- somewhere else, load the data back

local aState = Data[ 'state.txt' ]

Alternatively, for more "heavy duty persistence", you might want to look at Pluto:

http://lua-users.org/wiki/PlutoLibrary


[1] http://dev.alt.textdrive.com/browser/HTTP/Data.lua