Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Array of structs breaks when adding new structs.

    Bug Reporting (FUZE 4 Nintendo Switch)
    3
    7
    260
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • vinicity
      vinicity F last edited by

      I have a program that looks something like this:

      var segments = []
      segments[0] = [
          [.a = {200, 300}, .b = {240, 100}],
          [.a = {240, 100}, .b = {540, 100}],
          [.a = {540, 100}, .b = {240, 100}],
          // ..and a lot more statements like these...
      ]
      
      // Then a little later I do this:
      segments[0][len(segments[0])] = [.a = {840, 100}, .b = {620, 400}]
      print(len(segments[0]))
      update()
      sleep(3)
      
      // That seems to be working. But then I do it once more:
      segments[0][len(segments[0])] = [.a = {140, 600}, .b = {320, 120}]
      print(len(segments[0]))
      update()
      sleep(3)
      
      // This time the program crashes on the last print statement!
      
      

      This is the error that happens:

      LINE: 43
      FUNCTION: len
      
      Unrecognised type: 1146106016
      

      Interestingly, if I remove some of the segments from the initial segment definition I do not get the error.

      My example program for this has been shared and submitted. ID: X6473MND5C

      1 Reply Last reply Reply Quote 0
      • vinicity
        vinicity F last edited by

        If someone knows a workaround, I would very much appreciate it.

        1 Reply Last reply Reply Quote 0
        • vinicity
          vinicity F last edited by

          Possibly related to this:
          https://fuzearena.com/forum/topic/1349/len-is-broken-in-some-circumstances-with-2-15

          1 Reply Last reply Reply Quote 0
          • PickleCatStars
            PickleCatStars F last edited by

            Why not just keep track of the length in a seperate variable? Then you don’t have to use len()...

            1 Reply Last reply Reply Quote 0
            • vinicity
              vinicity F last edited by vinicity

              It seems broken in other ways too. For instance passing the array to str() yields a similar error.

              1 Reply Last reply Reply Quote 0
              • vinicity
                vinicity F last edited by

                As a workaround, I created a temp array, copied the contents of segments[0] using a loop, added the new segments, and finally copied the temp array back to segments[0] again.

                1 Reply Last reply Reply Quote 0
                • Willpowered
                  Willpowered Fuze Team last edited by

                  Thanks for the report- A fix is in the works!

                  1 Reply Last reply Reply Quote 3
                  • First post
                    Last post