lua-users home
lua-l archive

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

Hash: SHA1 wrote:
> If I would overwrite it in a way so that all memory used by  my
> lua_State* is inside my own (pre-allocated) buffer, I could just save
> and re-load that buffer to/from disc and resume execution. What do you
> think, will this work? It sounds pretty easy so far.

This will only work if you new buffer is loaded at the same address as
the old one, as there'll be pointers embedded all throughout the data.
And if there happen to be pointers anywhere else --- such as on the
stack --- then you will be in for what is technically known as A World
Of Pain! Personally I'd go for something like Pluto, which
saves/restores the state at a much higher level.

> 2. What are the first two lines for?
>  (void)ud;
>  (void)osize;
> They do absolutely nothing, right? Are they there to let the compiler
> check something?

They're to avoid 'unused parameter' warnings.

- --
┌─── ───── ─────
│ "All power corrupts, but we need electricity." --- Diana Wynne Jones,
│ _Archer's Goon_
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla -