Re: saving/restoring all global variables
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: saving/restoring all global variables
- From: Hans Fuchs <gucky@...>
- Date: 2004年10月17日 11:44:32 +0200
Hi Mario
whiteindian@arcor.de wrote:
I want to save/restore all global variables to/from a file. I did search this list first and I found references to a save.lua contained in the distro that should demonstrate how to do this if I understood correctly but this file isn't part of the current Lua distro. I downloaded the Lua 4 version but it doesn't work with Lua 5. How do I do what I want in Lua 5?
I think you could use this
http://www.lua.org/pil/12.1.1.html
or this
http://www.lua.org/pil/12.1.2.html
You can let it save the global environment _G.
--- From the manual
_G
A global variable (not a function) that holds the global environment
(that is, _G._G = _G). Lua itself does not use this variable; changing
its value does not affect any environment. (Use setfenv to change
environments
---
Best,
Hans