lua-users home
lua-l archive

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

kathrin_69@gmx.de 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.

- --
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "All power corrupts, but we need electricity." --- Diana Wynne Jones,
│ _Archer's Goon_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJxQc3f9E0noFvlzgRAjDjAJ0fl5SJ/m7pbLiiwWKDnnmNWAVmMgCglnwj
2wCSn7sQk+5PQuD81tHrlJI=
=rpgU
-----END PGP SIGNATURE-----