Because you keep modifying the topic, it's best to put it in a post instead of modifying the topic's OP every time.
This. We can't help you because we don't know you have another problem
Anyways, there's multiple ways to save files. If you want to save a list of global variables, you can
export("$Name*","file/path.cs"); with * as a wildcald, and reload with exec("file/path.cs");
If you want to save an object,
%obj.save("file/path.cs"); and then reload the same way with exec
Or you can do:
This if for reading/writing to files.
to write a file in any format you want
As for arrays, because of their shoddy implementation in Torquescript, there is no .Length method like other languages
You have two options: either keep track of the length of the array as you create it, or, if the array is indexed with contiguous integers, and no elements are blank, you can iterate through it until you find one with a blank value