P
Punch
Guest
Hi,
I'm going to try to convert an existing Javascript game to GM2, so far it looks pretty straight forward to convert but just wanted to ask anyone with experience about how I can use structs to replace a huge literal array I have. At the moment it looks like this:
- there are actually nearly 7000 lines like that. At the moment the only search I do is for the first string, using array.indexOf("7720-7721") for example, then I access the JSON type object, which sometimes also contains its own arrays.
So I'm wondering what's the best way of converting this sort of structure? If I converted it to this:
Would I have any access problems, and could I retain the structure in a better way? Ideally I'd like it to look as similar as possible to the original Javascript purely for legibility. Speed isn't an issue as I only address this once every mouse click or controller move.
Thanks.
I'm going to try to convert an existing Javascript game to GM2, so far it looks pretty straight forward to convert but just wanted to ask anyone with experience about how I can use structs to replace a huge literal array I have. At the moment it looks like this:
var array=[
"7720-7721",40,0,{o:"S",audVers:runS,run:1,sloop:["X",1]},
"7721-7821",45,0,{o:"E",audVers:runM,run:2},
];
- there are actually nearly 7000 lines like that. At the moment the only search I do is for the first string, using array.indexOf("7720-7721") for example, then I access the JSON type object, which sometimes also contains its own arrays.
So I'm wondering what's the best way of converting this sort of structure? If I converted it to this:
array={
v: {"7720-7721", 40, 0} ,o: "S", audVers:runS, run:1, sloop:{"X",1}},
}
Would I have any access problems, and could I retain the structure in a better way? Ideally I'd like it to look as similar as possible to the original Javascript purely for legibility. Speed isn't an issue as I only address this once every mouse click or controller move.
Thanks.