[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Saving (part of) the lua state
- From: PA <petite.abeille@...>
- Date: Mon, 22 Oct 2007 18:19:26 +0200
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