Your save game file only consists of these objects? Then it's pretty easy. You can do it this way:

Code:

function saveEntity(fileHandle, ent)
{
you = ent;
file_str_write(fileHandle,your.name);
file_str_write(fileHandle,delimit_str);
file_var_write(fileHandle,your.x);
file_var_write(fileHandle,your.y);
}



Now the loading function is the same, only backwards. You don't need to parse through any strings. The loop you are using with ent_next() is still the same as in your code.


Always learn from history, to be sure you make the same mistakes again...