Page 1 of 1

global property persistence in savegames

Posted: 02 Dec 2012, 02:38
by aubergine
I was looking through the C++ code the other day and from what I can tell, the JS API works out which global object properties not to save as follows:

* During environment initialisation, WZ puts all its functions, constants, etc., on global object
* After environment is initialised, a list is compiled of everything that lives on global object = stuff not to persist
* 'me' global is then added, it will get saved (desired behaviour) because it's not in list mentioned above
* When game is saved, WZ filters out the following:
** Stuff in the list compiled above is not persisted
** Stuff that is of type "function" is not persisted
** Constants in the global scope are not persisted
* All un-filtered vars and properties of the global object and scope are saved?

I was wondering what happens if I add a non-enumerable, non-configurable, non-writable property to the global object (using Object.defineProperty) - will that get persisted to the save game or not? (I hope not... If it does, can it be made not to?)

Re: global property persistence in savegames

Posted: 02 Dec 2012, 12:00
by Duha
aubergine wrote: I was wondering what happens if I add a non-enumerable, non-configurable, non-writable property to the global object (using Object.defineProperty) - will that get persisted to the save game or not? (I hope not... If it does, can it be made not to?)
Saves is humanreadble text.

Re: global property persistence in savegames

Posted: 02 Dec 2012, 14:44
by Per
Don't know. There is only one way to find out.

PS Please do not put "@name" in the topic. That is kinda annoying and defeats the purpose of this being a forum, I think.