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

All topics about ZGameEditor goes here.

Moderator: Moderators

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

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

Post 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>
User avatar
VilleK
Site Admin
Posts: 2274
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 »

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: 475
Joined: Sat Feb 15, 2014 9:54 am

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

Post by rrTea »

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