Problem reading from Array after loading with JSON

0 favourites
  • 5 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hi,

    I loaded my Array with a JSON string like this:


    When I do Array.At(0,0) I get just "A" instead of "Africa". Likewise if I read Array.At(3, 0) I get "E" instead of "EasternEurope".

    When I use the debugger to watch the Array it shows the correct Json data loaded as shown above with the correct length.

    However, if I do an Array.Count it returns just 1, instead of 21.

    Any help would be appreciated.

    (I'm using R144)


  • Maybe your format is wrong?



    Note: Array.count return the number of instance for that object and not the length x,y,z of the array. You can get the x-axis with width, y-axis with height and z-axis with depth.


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Scale your text object in the editor... It does not auto scale so you either need to scale it in the editor, or at runtime with your code.

    You are only displaying the first few letters because the text object probably is not wide enough.

  • I don't quite understand the idea behind this but c4sp3r89, you are right. Adding the extra bracket between each parameter seems to do the trick.

  • its because of the array size you define as [3,7,1] so you need to specify 1 slot for the z-axis.

    And if you do ["Africa",1,2,3,4,5,6] the enclosed [] will be 1 slot. So you cant get anything back as the format is wrong. Doing [["Africa"],[1],[2],[3],[4],[5],[6]] will set each of the item inside [] as a slot.

    So basically:


    ["Africa"],[1],[2],[3],[4],[5],[6]] is "size":[1,7,0] [[

    ["Africa"],[1],[2],[3],[4],[5],[6]]] is "size":[1,7,1]

    eg1: [x0[y0][y1],[y2],[y3],[y4],[y5],[y6]]

    eg2: [x0[y0][y1],[y2],[y3],[y4],[y5],[y6]],



    Something like that. I hope i'm not wrong. <img src="smileys/smiley24.gif" border="0" align="middle" />

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