Saving and reading data

What function sould I put the save data and read data. Also what is the difference between local, global, and project data?

@andrewsimpson4 in the past i remember there was some prblem with numbers and text. To solve it definitly i decided to save always converting numbers to string, with tostring(), then when reading back to convert back to number, with tonumber(). Then i never had problems again. However, this might not be your problem here.

@Andrewsimpson4 Here’s an example of saving and displaying local data.


function setup()
    value=123
    saveLocalData("abc",value)
    value=3214
    saveLocalData("rty",value)
    value=653
    saveLocalData("xse",value)
    
    ld=listLocalData()
    for a,b in pairs(ld) do
        print(b,readLocalData(b))
    end
end

Im having a problem getting my numbers in my app the save correctly. What function should I
put the save and read data in? @dave1707

Many people here HATE Project Data, as it doesn’t get deleted with you’re project, local data is for Highscores, and Global data is something you want all(or a vast majority or two) of your projects to have access to.
For levels: do Project, For Highscores: do local

@CodeaNoob Local data doesn’t get deleted with the project either. Both local and project data could be a problem if you save a lot of data and then delete the project without deleting the data first.