Navigation

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

    Iterating over two-dimensional arrays

    Bug Reporting (FUZE 4 Nintendo Switch)
    2
    4
    189
    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.
    • emptytheory
      emptytheory F last edited by

      Why does the following program run into an error ("Unknown type: 4"),

      array small[2]
      array big[3]
      for i = 0 to len(small) loop
          small[i] = big
      repeat
      
      counter = 0
      for i = 0 to len(small) loop
          for j = 0 to len(big) loop
              small[i][j] = 1
              counter += 1
              print(counter, ": ", small, "\n")
              update()
              sleep(1)
          repeat
      repeat
      

      while this one does not?:

      array small[2]
      array big[3]
      for i = 0 to len(big) loop
          big[i] = small
      repeat
      
      counter = 0
      for i = 0 to len(big) loop
          for j = 0 to len(small) loop
              big[i][j] = 1
              counter += 1
              print(counter, ": ", big, "\n")
              update()
              sleep(1)
          repeat
      repeat
      
      1 Reply Last reply Reply Quote 0
      • M
        MikeDX last edited by

        Is there a line number where it breaks?

        Am I missing something or is it identical except for array variable names?

        emptytheory 1 Reply Last reply Reply Quote 0
        • emptytheory
          emptytheory F @MikeDX last edited by

          @MikeDX It gets to line 13 two times, but I get the error the third time.

          The difference is between (i) a short array with long arrays as elements, and (ii) a long array with short arrays as elements. The first kind gets the error message.

          1 Reply Last reply Reply Quote 0
          • M
            MikeDX last edited by

            This is definitely a bug and I shall go file it in our issue tracker. Thanks for pointing it out (and the code!)

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