lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> Very nice.
> The way I want to do persistance is by saving precompiled code, but I 
never
> find the time to do it.

I guess I could compile the string that Lua Pickle produces.
I was considering putting the unpickling code in the pickled data so
just doing a dostring would result in the unpickled datastructure.
See has advantages(like pickle version independence) but it would increase
the stored pickle size. Is that what you were thinking of? 

> Some comments:
> 
>  If the Lua function source was stored by the vm,
>  storing structures with lua functions would be possible. 
> 
> It does, if the functions are defined via dostring instead of dofile.

Yes, unfortunately I can't rely on all functions being defined that way.
I guess I could have pickle only raise an error for non-dostring defined
functions, but it would be nice if it worked in all cases.

>  I'm not sure that "[[ ]]" will work in all cases. 
>
> Then use format("%q",...) instead.

Great - I'll give that a try.

Steve