How do I fetch string value from an array?

  • I believe it's a trivial problem but I really can't find the answer anywhere by google nor this forum, so I'm making a post (sorry if this is redundant but couldn't find it).

    I'm loading data from server (PHP) to an array in C2. Data goes encoded with JSON as 2d array with looks more or less like that:

    {"c2array":true,"size":[5,3,null],"data":[["1","One-1","One-2"],["2","Oj","a"],["3","Mawy","a"],["4","Dake sw","a"],["5","Rowa","ezao celtah, myce, grah"]]}[/code:11jubse7]
    
    I tried also with size [5,3,1] and [5,3,0]. My problem here is that when I do foreach (XY) loop then for the indexes where I would expect a string as a value, I recieve a single character. For example myArray.at(0,1) returns "O" instead of whole string "One-1".  Same thing happens when I use CurValue just to debug data.
    
     Any help please?
  • Try Construct 3

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

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

    I think it sould be :

    {"c2array":true,"size":[5,3,1],"data":[[["1"],["One-1"],["One-2"]],[["2"],["Oj"],["a"]],[["3"],["Mawy"],["a"]],[["4"],["Dake sw"],["a"]],[["5"],["Rowa"],["ezao celtah"],["myce"], ["grah"]]]}

  • I think it sould be :

    {"c2array":true,"size":[5,3,1],"data":[[["1"],["One-1"],["One-2"]],[["2"],["Oj"],["a"]],[["3"],["Mawy"],["a"]],[["4"],["Dake sw"],["a"]],[["5"],["Rowa"],["ezao celtah"],["myce"], ["grah"]]]}

    Hi beufreecasse!

    That's the charm I was looking for! Thank you very much I stucked with this second day already and you saved me!

  • Glad to help

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