+SecretSquirrel-BJC Posted May 26, 2009 Share Posted May 26, 2009 (edited) Probably another dumb question I read in Whack a Lackey, that arrays and timers are not retained across save-resumes However I have the following issue If I have a variable A defined at the outermost scope of the LUA program, initially set to 1 Then later it gets updated to 2 If the cartridge is saved and resumed, then I would expect it to stay at 2. But it doesn't. Do all variables behave like this? Or is there some special setting/construc that I need to use? PS not using the builder interface except to compile and test PPS My workaround might be to stuff variables inside something that will be retained like an item.name or description etc Edited May 26, 2009 by SecretSquirrel-BJC Quote Link to comment
+SecretSquirrel-BJC Posted May 28, 2009 Author Share Posted May 28, 2009 Thinking out aloud to myself.... Just found out that if I had added the global variable to <cart>.ZVariables then any value changes would have persisted across the save/restore. Doh!! If you don't add it, then on restore, the global variable gets reset to the same value as it had at the start. Very interesting. Stuffing them into another object also worked. Quote Link to comment
+bretina Posted August 29, 2012 Share Posted August 29, 2012 By "Stuffing them into another object worked" do you mean compressing your data to a single string and storing it in an items name, description, etc? For your global variables you put in ZVariables, were they basic types (int, string) or did you try something more complex like an Array? Thinking out aloud to myself.... Just found out that if I had added the global variable to <cart>.ZVariables then any value changes would have persisted across the save/restore. Doh!! If you don't add it, then on restore, the global variable gets reset to the same value as it had at the start. Very interesting. Stuffing them into another object also worked. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.