Page 1 of 1

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

Posted: Tue Sep 03, 2019 6:54 am
by rrTea
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>

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

Posted: Tue Sep 03, 2019 10:32 am
by VilleK
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).

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

Posted: Tue Sep 03, 2019 11:11 am
by rrTea
Aah right, I got confused. Thanks for the clarification :)