Are arrays persistent even when "Persistent" is not selected?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
rrTea
Posts: 383
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Are arrays persistent even when "Persistent" is not selected?

Post by rrTea » Tue Sep 03, 2019 6:54 am

For example if I run this from Preview, the first time it will print 1, but the second time it will return 0. Running it for the third time it returns 1 again (basically it works as expected every odd time). I thought arrays do not keep their contents if they are not set to "Persistent"?

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" FileVersion="2">
  <OnLoaded>
    <ZExpression>
      <Expression>
<![CDATA[Array1[0] = 1-Array1[0];

trace ( intToStr(Array1[0]) );
quit();]]>
      </Expression>
    </ZExpression>
  </OnLoaded>
  <Content>
    <Array Name="Array1" Type="4" SizeDim1="1"/>
  </Content>
</ZApplication>

User avatar
VilleK
Site Admin
Posts: 2029
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Are arrays persistent even when "Persistent" is not selected?

Post by VilleK » Tue Sep 03, 2019 10:32 am

Persistent only means that the content will be stored on file (both in the zgeproj and the final executable). I guess it could be cleared when stopping designer, but the current behaviour is the same with Variables (they are not reset between preview runs).

User avatar
rrTea
Posts: 383
Joined: Sat Feb 15, 2014 9:54 am
Contact:

Re: Are arrays persistent even when "Persistent" is not selected?

Post by rrTea » Tue Sep 03, 2019 11:11 am

Aah right, I got confused. Thanks for the clarification :)

Post Reply