save _G, snaphot fix

This commit is contained in:
p.kosyh 2010-06-17 16:05:27 +00:00
parent 668eb49678
commit 5517a2cdc4
2 changed files with 3 additions and 0 deletions

1
debian/changelog vendored
View file

@ -19,6 +19,7 @@ instead (1.2.0) unstable; urgency=low
* disable/enable/disable_all/enable_all added;
* exist() added (seen over disabled objects);
* improved debugger;
* save vars in _G;
* many small bugfixes...
-- Peter Kosyh <p.kosyh@gmail.com> Tue, 01 Jun 2010 17:40:00 +0300

View file

@ -1528,6 +1528,7 @@ function game_save(self, name, file)
end
for_each_object(save_object, h);
save_object('game', self, h);
save_object('_G', _G, h);
clearvar(_G);
h:flush();
h:close();
@ -2369,6 +2370,7 @@ function restore_snapshot(nr)
local ss = game._snapshots
if not ss[nr] then return nil, true end -- nothing todo
stead_init();
game.lifes:zap();
dofile('main.lua');
if type(init) == 'function' then -- no hooks here!!!
init();