Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to Save, in Codea

edited June 2013 in Questions Posts: 23

I an currently working on a project that has a score(increases every time I pick up an object). I would like to be able to save that score so every time I open up the app my score stays the same and I don't have to start over completely.


  • BriarfoxBriarfox Mod
    edited June 2013 Posts: 1,542

    Check out the codea reference for:




    basically its:

    local score = 100
    readScore = readProjectData("Saved_Score")
  • Jmv38Jmv38 Mod
    Posts: 3,297

    Also there are some tricks with the type of what you save: numbers turn into strings or so. It is a bit of a headache at the beginning.

  • Jmv38Jmv38 Mod
    edited June 2013 Posts: 3,297

    This works:
    for saving i use global data, to keep the score even if i change the project name (or version). Tostring() makes sure i contol the type


    When reading, i have to convert back to number

    score = tonumber(readGlobalData("thisGameScore")) or 0
  • Posts: 23

    Thanks, that really helped! My game is going to be much better now!

Sign In or Register to comment.