How to save table data in Documents directory path and how to delete a wrong file there?

Hi all,

I realize that testing my code to save a Table to a file I have to iterate across each table.pos and convert its content to string by using tostring function. But, if I made a mistake when I tested on the simulator, how can I remove the wrong file created on DocumentsDirectory path, because after I fix the error the previous file still existing on the directory, so I can remove it to start again and see my new results.

I closed simulator, thinking that it will reset that temporary file, but for surprise me, it still in some place and I can’t recreate it again.

So, questions are:

  • Is this file under DocumentsDirectory created in a simulator folder, where I can delete it?
  • Is there any file function to force file deleting from LUA code?
  • Any good example on how to save and load a table, my intention is to create SaveScoreTable and LoadScoreTable functions. So a ScoreList table is create containing at least playerName, levelPlayed, Score, extras

Flavio.
[import]uid: 3022 topic_id: 703 reply_id: 300703[/import]

There was some misspelling in the previous post, so I put it again.

Hi all,

I realize that testing my code to save a Table to a file I have to iterate across each table.pos and convert its content to string by using tostring function. But, if I made a mistake when I tested on the simulator, how can I remove the wrong file created on DocumentsDirectory path, because after I fixed the error the previous file still existing on the directory, so I can’t remove it to start again and see my new results.

I closed simulator, thinking that it will reset that temporary file, but for surprise me, it still in some place and I can’t recreate it again.

So, questions are:

  • Is this file under DocumentsDirectory created in a simulator folder, where I can delete it?
  • Is there any file function to force file deleting from LUA code?
  • Any good example on how to save and load a table, my intention is to create SaveScoreTable and LoadScoreTable functions. So a ScoreList table is create containing at least playerName, levelPlayed, Score, extras

Flavio. [import]uid: 3022 topic_id: 703 reply_id: 1404[/import]