Saving a table

Hello, sorry i have a nooby question. Does anyone know how to save the values in a table? I know how to save, for example, the high score and stuff, but when it comes to a table, i don’t know how to do it more efficiently. I cannot figure out if i could create a corresponding table if it’s possible. So the only way i am doing it currently is to save the different values manually, which i am guessing there might be a brighter way I don’t know. Thanks in advance!

PS, trying to be clearer, ill make up something i want to save
Data[1] = “player1”
Data[2] = 123
Data[3] = 456
.
.
.
Etc

There is a way, @Toshio, but it’s a little bit complicated in Lua. This is due to the fact that tables can contain anything, including other tables (including themselves).

This implementation writes a table to disk:

http://lua-users.org/wiki/SaveTableToFile

However since Codea doesn’t support io.read/write you might want to instead change those write calls to append to a string. Then store the string in saveLocalData or saveProjectData (whichever is more appropriate for you).

Thank you Simeon for the reply. That’s too advanced for me. I am gonna continue my tedious way while I try to completely understand that. XD

Edit
Nvm, i can’t understand the link you sent me, but I somehow figured out your table-to-string-and-save method. Thanks!