How do I initialize an array and retrieve its value by position?

0 favourites
  • 2 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I have the following data:


    I want to load it into an array and then retrieve any of its values by calling its position in the array, i.e. arrBill.At(0).

    How do I load it up to begin with?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • farmersfable

    there are many ways to do it - if the data isn't likely to change after you export your game, then you can copy and paste the data into a text variable and use tokencount and tokenat to break it apart and put in the array.

    you could also add a text file to the project and load that, or you can use AJAX to request the data from a database, or other external source at runtime.

    I made a quick sample of the first option...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)